diff --git a/front_end/src/components/markdown_editor/initialized_editor.tsx b/front_end/src/components/markdown_editor/initialized_editor.tsx index 3c019f99bf..cbf6038275 100644 --- a/front_end/src/components/markdown_editor/initialized_editor.tsx +++ b/front_end/src/components/markdown_editor/initialized_editor.tsx @@ -73,9 +73,22 @@ const PrismCodeBlock: FC<{ code?: string; language?: string }> = ({ theme === "dark" ? prismThemes.dracula : prismThemes.github; const raw = (language as string | undefined) ?? "ts"; - const prismLang = CANONICAL_TO_PRISM[normalizeLang(raw)] ?? "tsx"; + const normalizedLang = normalizeLang(raw); const codeTrimmed = (code ?? "").replace(/^\n+|\n+$/g, ""); + // Handle plain text without syntax highlighting + if (normalizedLang === "text") { + return ( +
+
+          {codeTrimmed}
+        
+
+ ); + } + + const prismLang = CANONICAL_TO_PRISM[normalizedLang] ?? "tsx"; + return (
= { + text: "text", + plaintext: "text", + plain: "text", + typescript: "ts", ts: "ts", tsx: "tsx", @@ -42,6 +47,7 @@ export function normalizeLang( } export const CANONICAL_TO_PRISM: Record = { + text: "text" as Language, ts: "typescript", tsx: "tsx", js: "javascript",