From 4ab4d7b6dbd8f530909d85d2301dae09fb257faf Mon Sep 17 00:00:00 2001 From: ccnetcore Date: Thu, 12 Feb 2026 18:09:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dmarkdown=E6=B8=B2?= =?UTF-8?q?=E6=9F=93=E8=84=9A=E6=9C=AC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Yi.Ai.Vue3/.claude/settings.local.json | 4 +- .../src/components/MarkedMarkdown/index.vue | 31 ++++++++++--- .../components/TokenFormDialog.vue | 45 ++++++++++++++++++- 3 files changed, 71 insertions(+), 9 deletions(-) diff --git a/Yi.Ai.Vue3/.claude/settings.local.json b/Yi.Ai.Vue3/.claude/settings.local.json index 89b03152..842aaa71 100644 --- a/Yi.Ai.Vue3/.claude/settings.local.json +++ b/Yi.Ai.Vue3/.claude/settings.local.json @@ -10,7 +10,9 @@ "Bash(npm install marked --save)", "Bash(pnpm add marked)", "Bash(pnpm lint:*)", - "Bash(pnpm list:*)" + "Bash(pnpm list:*)", + "Bash(pnpm vue-tsc:*)", + "Bash(pnpm build:*)" ], "deny": [], "ask": [] diff --git a/Yi.Ai.Vue3/src/components/MarkedMarkdown/index.vue b/Yi.Ai.Vue3/src/components/MarkedMarkdown/index.vue index 6609df93..f0954924 100644 --- a/Yi.Ai.Vue3/src/components/MarkedMarkdown/index.vue +++ b/Yi.Ai.Vue3/src/components/MarkedMarkdown/index.vue @@ -10,11 +10,13 @@ import { useDesignStore } from '@/stores'; interface Props { content: string; theme?: 'light' | 'dark' | 'auto'; + sanitize?: boolean; } const props = withDefaults(defineProps(), { content: '', theme: 'auto', + sanitize: true, }); const designStore = useDesignStore(); @@ -94,7 +96,12 @@ const renderer = { // 行内代码 codespan(token: { text: string }) { - return `${token.text}`; + // 转义 HTML 标签,防止