Skip to content

Commit

Permalink
Link parenthesis (#1509)
Browse files Browse the repository at this point in the history
Link parenthesis
  • Loading branch information
UziTech authored Jul 2, 2019
2 parents 2a1bbed + 59ec6fb commit 6bae3a2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/marked.js
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ InlineLexer.prototype.output = function(src) {
if (cap = this.rules.link.exec(src)) {
var lastParenIndex = findClosingBracket(cap[2], '()');
if (lastParenIndex > -1) {
var linkLen = cap[0].length - (cap[2].length - lastParenIndex) - (cap[3] || '').length;
var linkLen = 4 + cap[1].length + lastParenIndex;
cap[2] = cap[2].substring(0, lastParenIndex);
cap[0] = cap[0].substring(0, linkLen).trim();
cap[3] = '';
Expand Down
5 changes: 5 additions & 0 deletions test/specs/new/links_paren.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<p>(<a href="http://example.com/1">one</a>) (<a href="http://example.com/2">two</a>)</p>

<p>(<a href="http://example.com/1">one</a>) (<a href="http://example.com/2">two</a>)</p>

<p>(<a href="http://example.com/1" title="a">one</a>) (<a href="http://example.com/2" title="b">two</a>)</p>
5 changes: 5 additions & 0 deletions test/specs/new/links_paren.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
([one](http://example.com/1)) ([two](http://example.com/2))

([one](http://example.com/1)) ([two](http://example.com/2))

([one](http://example.com/1 "a")) ([two](http://example.com/2 "b"))

0 comments on commit 6bae3a2

Please sign in to comment.