Skip to content

Commit

Permalink
fix image parens
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Oct 3, 2019
1 parent 76dadaf commit 6725e71
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/marked.js
Expand Up @@ -723,7 +723,8 @@ InlineLexer.prototype.output = function(src) {
if (cap = this.rules.link.exec(src)) {
var lastParenIndex = findClosingBracket(cap[2], '()');
if (lastParenIndex > -1) {
var linkLen = 4 + cap[1].length + lastParenIndex;
var start = cap[0].indexOf('!') === 0 ? 5 : 4;
var linkLen = start + cap[1].length + lastParenIndex;
cap[2] = cap[2].substring(0, lastParenIndex);
cap[0] = cap[0].substring(0, linkLen).trim();
cap[3] = '';
Expand Down
3 changes: 3 additions & 0 deletions test/specs/new/image_paren.html
@@ -0,0 +1,3 @@
<p><img src="img1.svg" alt=""> (or <img src="img2.svg" alt="">)</p>

<p><img src="img1.svg" alt="one"> (or <img src="img2.svg" alt="two">)</p>
3 changes: 3 additions & 0 deletions test/specs/new/image_paren.md
@@ -0,0 +1,3 @@
![](img1.svg) (or ![](img2.svg))

![one](img1.svg) (or ![two](img2.svg))

0 comments on commit 6725e71

Please sign in to comment.