showdown2.subParser("githubCodeBlocks", function(text, options2, globals) {
"use strict";
if (!options2.ghCodeBlocks) {
return text;
}
text = globals.converter._dispatch("githubCodeBlocks.before", text, options2, globals);
text += "\xA80";
text = text.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g, function(wholeMatch, delim, language, codeblock) {
var end = options2.omitExtraWLInCodeBlocks ? "" : "\n";
codeblock = showdown2.subParser("encodeCode")(codeblock, options2, globals);
codeblock = showdown2.subParser("detab")(codeblock, options2, globals);
codeblock = codeblock.replace(/^\n+/g, "");
codeblock = codeblock.replace(/\n+$/g, "");
codeblock = "<pre><code" + (language ? ' class="' + language + " language-" + language + '"' : "") + ">" + codeblock + end + "</code></pre>";
codeblock = showdown2.subParser("hashBlock")(codeblock, options2, globals);
return "\n\n\xA8G" + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock}) - 1) + "G\n\n";
});
text = text.replace(/¨0/, "");
return globals.converter._dispatch("githubCodeBlocks.after", text, options2, globals);
});
这是esbuild 编译后的一段代码,其中一段代码text = text.replace(/¨0/, "");更改了原始代码,原始代码是text = text.replace(/¨0/, "");多了一个字符Â。导致正则替换不成功。