The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 25, 07:30 UTC
fix: add error logging for code highlighting failures (#951)
Qiaochu Hu committed
Mar 13, 2026 at 03:35 UTC
b496ae839529b910d5a35e9e05d6be704a41b5a5
1 file changed
+7
-6
apps/web/src/components/ChatMarkdown.tsx
+7
-6
@@ -1,8 +1,4 @@
1
-import {
2
- getSharedHighlighter,
3
- type DiffsHighlighter,
4
- type SupportedLanguages,
5
-} from "@pierre/diffs";
1
+import { DiffsHighlighter, getSharedHighlighter, SupportedLanguages } from "@pierre/diffs";
2
import { CheckIcon, CopyIcon } from "lucide-react";
3
import React, {
4
Children,
@@ -213,7 +209,12 @@ function SuspenseShikiCodeBlock({
209
const highlightedHtml = useMemo(() => {
210
try {
211
return highlighter.codeToHtml(code, { lang: language, theme: themeName });
216
- } catch {
212
+ } catch (error) {
213
+ // Log highlighting failures for debugging while falling back to plain text
214
+ console.warn(
215
+ `Code highlighting failed for language "${language}", falling back to plain text.`,
216
+ error instanceof Error ? error.message : error,
217
+ );
218
// If highlighting fails for this language, render as plain text
219
return highlighter.codeToHtml(code, { lang: "text", theme: themeName });
220
}