fix: 修复 esbuild 正则/模板字面量解析问题(反引号兼容性)
This commit is contained in:
@@ -12,7 +12,8 @@ function parseMarkdown(md: string): string {
|
||||
let html = escapeForMd(md);
|
||||
|
||||
// 代码块 ```...```
|
||||
html = html.replace(/```(\w*)\n([\s\S]*?)```/g, (_m, lang, code) => {
|
||||
const codeBlockRe = new RegExp('```(\\w*)\\n([\\s\\S]*?)```', 'g');
|
||||
html = html.replace(codeBlockRe, (_m, lang, code) => {
|
||||
return `<pre><code class="language-${lang}">${code.trim()}</code></pre>`;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user