From 30a8738092a88bb887e0fc80e28fa398e26580f5 Mon Sep 17 00:00:00 2001 From: yutent Date: Thu, 4 May 2023 15:24:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96code=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E6=B8=B2=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/code/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/code/index.js b/src/code/index.js index ee61075..3f2cf55 100644 --- a/src/code/index.js +++ b/src/code/index.js @@ -194,7 +194,9 @@ class Code extends Component { txt = colorMd(txt) break } - + // 除代码高亮用的特殊标签 外, 其他的全部转义 + // 避免渲染时混乱 + txt = txt.replace(/<(\/?)(?!c)(\w+)([^>]*?)>/g, '<$1$2$3>') this.#code = txt.split('\n') }