fix(chat): prevent normalizeInlineCodeFences from breaking adjacent fenced code blocks (#903)

This commit is contained in:
chenxiccc
2026-06-20 00:40:26 +08:00
committed by GitHub
parent 7ca355651f
commit 4712431be8

View File

@@ -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;
}