浏览代码

fix: 代码块嵌入小代码块时渲染错误

opchips 1 年之前
父节点
当前提交
e56216549e
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      app/components/markdown.tsx

+ 4 - 0
app/components/markdown.tsx

@@ -248,6 +248,10 @@ function escapeBrackets(text: string) {
 
 function tryWrapHtmlCode(text: string) {
   // try add wrap html code (fixed: html codeblock include 2 newline)
+  // ignore embed codeblock
+  if (text.includes("```")) {
+    return text;
+  }
   return text
     .replace(
       /([`]*?)(\w*?)([\n\r]*?)(<!DOCTYPE html>)/g,