From 59ec6fba0c5fe5b69d8f3c953a56aa9934075d0a Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Tue, 2 Jul 2019 08:40:28 -0500 Subject: [PATCH] fix calculation --- lib/marked.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/marked.js b/lib/marked.js index d07c39618f..52c178bc30 100644 --- a/lib/marked.js +++ b/lib/marked.js @@ -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] = '';