From 9c2c6d724ea9cfa7a0ac93371699681404d53222 Mon Sep 17 00:00:00 2001 From: lin onetwo Date: Sun, 9 Jun 2024 23:01:07 +0800 Subject: [PATCH] fix: link end position should add ^id 's length --- core/modules/parsers/wikiparser/rules/prettylink.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/modules/parsers/wikiparser/rules/prettylink.js b/core/modules/parsers/wikiparser/rules/prettylink.js index b1172ac4a..f577dba8c 100644 --- a/core/modules/parsers/wikiparser/rules/prettylink.js +++ b/core/modules/parsers/wikiparser/rules/prettylink.js @@ -40,7 +40,7 @@ exports.parse = function() { textEndPos = this.matchRegExp.lastIndex - 2; } var linkStart = this.match[2] ? (start + this.match[1].length + 1) : start; - var linkEnd = linkStart + link.length; + var linkEnd = anchor ? (linkStart + link.length + 1 + anchor.length) : (linkStart + link.length); if($tw.utils.isLinkExternal(link)) { // add back the part after `^` to the ext link, if it happen to has one. if(anchor) {