diff --git a/server/utils/mdKit.ts b/server/utils/mdKit.ts index 8150de86ad..dc020a242d 100644 --- a/server/utils/mdKit.ts +++ b/server/utils/mdKit.ts @@ -59,7 +59,8 @@ export async function createCodeHighlighter(): Promise { // Syntax highlighting for code blocks (uses shared highlighter) return ({ text, lang }: Tokens.Code) => { - const html = highlightCodeSync(shiki, text, lang || 'text') + const language = (lang || '').match(/^\S+/)?.[0] || 'text' + const html = highlightCodeSync(shiki, text, language) // Add copy button return `