From 4712431be81718dfb559ef43d7d7d5315bf4e01a Mon Sep 17 00:00:00 2001 From: chenxiccc Date: Sat, 20 Jun 2026 00:40:26 +0800 Subject: [PATCH] fix(chat): prevent normalizeInlineCodeFences from breaking adjacent fenced code blocks (#903) --- src/components/chat/utils/chatFormatting.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/chat/utils/chatFormatting.ts b/src/components/chat/utils/chatFormatting.ts index d0bb5293..418fb56e 100644 --- a/src/components/chat/utils/chatFormatting.ts +++ b/src/components/chat/utils/chatFormatting.ts @@ -11,7 +11,7 @@ export function decodeHtmlEntities(text: string) { export function normalizeInlineCodeFences(text: string) { if (!text || typeof text !== 'string') return text; try { - return text.replace(/```\s*([^\n\r]+?)\s*```/g, '`$1`'); + return text.replace(/```[ \t]*([^\n\r]+?)[ \t]*```/g, '`$1`'); } catch { return text; }