From a40b7b31ee09a9ec5fa04da24f0e67a4b92145ca Mon Sep 17 00:00:00 2001 From: Suzumiya Date: Tue, 15 Sep 2026 23:41:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=20Markdown=20=E7=A9=BA?= =?UTF-8?q?=E7=99=BD=E8=A1=8C=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 兼容带空格的连续空行,保留 Markdown 段落分隔语义 --- .../src/components/ChatMarkdownMessage/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/ai-game-creator-shell/src/components/ChatMarkdownMessage/index.tsx b/apps/ai-game-creator-shell/src/components/ChatMarkdownMessage/index.tsx index ad2ebaa39..72cd5b777 100644 --- a/apps/ai-game-creator-shell/src/components/ChatMarkdownMessage/index.tsx +++ b/apps/ai-game-creator-shell/src/components/ChatMarkdownMessage/index.tsx @@ -20,7 +20,9 @@ function normalizeMarkdownBlankLines(text: string) { return text .split(/(```[\s\S]*?```)/g) .map((part, index) => - index % 2 === 1 ? part : part.replace(/\n{3,}/g, '\n\n'), + index % 2 === 1 + ? part + : part.replace(/[ \t]*\n(?:[ \t]*\n){2,}/g, '\n\n'), ) .join(''); }