Skip to content

Commit 8150703

Browse files
ranvier2d2claude
andcommitted
fix: map gitignore to ini for Shiki syntax highlighting
Shiki doesn't bundle a gitignore grammar, causing a resolveLanguage error. Map gitignore to ini (close syntax match) in extractFenceLanguage. Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent b37279c commit 8150703

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

apps/web/src/components/ChatMarkdown.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ const highlighterPromiseCache = new Map<string, Promise<DiffsHighlighter>>();
6666

6767
function extractFenceLanguage(className: string | undefined): string {
6868
const match = className?.match(CODE_FENCE_LANGUAGE_REGEX);
69-
return match?.[1] ?? "text";
69+
const raw = match?.[1] ?? "text";
70+
// Shiki doesn't bundle a gitignore grammar; ini is a close match (#685)
71+
return raw === "gitignore" ? "ini" : raw;
7072
}
7173

7274
function nodeToPlainText(node: ReactNode): string {

0 commit comments

Comments
 (0)