From 75eae870e0eafa6cd415c0d73acec8c31e2f7ba0 Mon Sep 17 00:00:00 2001 From: gaoziman <2942894660@qq.com> Date: Wed, 24 Dec 2025 15:59:51 +0800 Subject: [PATCH] =?UTF-8?q?fix(CodeBlock):=20=E4=BF=AE=E5=A4=8D=20HTML=20?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E5=88=A4=E6=96=AD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 限制 HTML 预览仅支持 html/htm 类型 - 移除对 xml/svg 等 markup 类型的预览支持 --- src/components/markdown/CodeBlock.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/markdown/CodeBlock.tsx b/src/components/markdown/CodeBlock.tsx index d7f2a3d..1dd0596 100644 --- a/src/components/markdown/CodeBlock.tsx +++ b/src/components/markdown/CodeBlock.tsx @@ -88,9 +88,8 @@ export function CodeBlock({ // 规范化语言名称 const normalizedLanguage = languageAliases[language.toLowerCase()] || language.toLowerCase(); - // 判断是否支持 HTML 预览 - const isHtmlPreviewable = ['html', 'htm', 'markup'].includes(normalizedLanguage) || - ['html', 'htm'].includes(language.toLowerCase()); + // 判断是否支持 HTML 预览(仅 html/htm,不包括 xml/svg) + const isHtmlPreviewable = ['html', 'htm'].includes(language.toLowerCase()); // 判断是否可执行:语言支持 + 代码满足执行条件 const canRun = isRunnableLanguage(language) && isCodeExecutable(code, language);