From 63638ce4a1ba4f228d365d926bc40e17e4b7a07e Mon Sep 17 00:00:00 2001
From: cherishsince <cherishsince@aliyun.com>
Date: Tue, 21 May 2024 22:43:50 +0800
Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91try=20mkard?=
 =?UTF-8?q?own=20=E7=BB=84=E4=BB=B6=E5=BC=82=E5=B8=B8=EF=BC=8C=E5=9B=A0?=
 =?UTF-8?q?=E4=B8=BA=20stream=20=E6=A8=A1=E5=9E=8B=E5=8F=AF=E8=83=BD?=
 =?UTF-8?q?=E8=BF=94=E5=9B=9E=E7=9A=84=E4=BF=A1=E6=81=AF=E4=B8=8D=E5=85=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/components/MarkdownView/index.vue | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/components/MarkdownView/index.vue b/src/components/MarkdownView/index.vue
index 125219cc..bf9ddd60 100644
--- a/src/components/MarkdownView/index.vue
+++ b/src/components/MarkdownView/index.vue
@@ -20,7 +20,12 @@ const contentRef = ref()
 // marked 渲染器
 const renderer = {
   code(code, language, c) {
-    const highlightHtml = hljs.highlight(code, {language: language, ignoreIllegals: true}).value
+    let highlightHtml
+    try {
+      highlightHtml = hljs.highlight(code, {language: language, ignoreIllegals: true}).value
+    } catch (e) {
+      // skip
+    }
     const copyHtml = `<div id="copy" data-copy='${code}' style="position: absolute; right: 10px; top: 5px; color: #fff;cursor: pointer;">复制</div>`
     return `<pre style="position: relative;">${copyHtml}<code class="hljs">${highlightHtml}</code></pre>`
   }