fix: code block rendering exception (#273)

无名代码块渲染导致渲染失败 fix #272
This commit is contained in:
YangFong 2024-02-21 14:36:27 +08:00 committed by GitHub
parent 72cb6da810
commit 9461585d9e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -126,7 +126,7 @@ class WxRenderer {
text = text.replace(/<p.*?>/g, `<p ${getStyles("blockquote_p")}>`); text = text.replace(/<p.*?>/g, `<p ${getStyles("blockquote_p")}>`);
return `<blockquote ${getStyles("blockquote")}>${text}</blockquote>`; return `<blockquote ${getStyles("blockquote")}>${text}</blockquote>`;
}; };
renderer.code = (text, lang) => { renderer.code = (text, lang = "") => {
if (lang.startsWith("mermaid")) { if (lang.startsWith("mermaid")) {
setTimeout(() => { setTimeout(() => {
window.mermaid?.run(); window.mermaid?.run();