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') }