From 11597be8f92dc55a31f661be7b0aed87aa009f67 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Fri, 12 Dec 2025 13:31:17 +0000 Subject: [PATCH 1/2] Add plain text option to markdown editor code blocks - Added "Plain text" option to code block language selector - Added aliases (text, plaintext, plain) for plain text - Modified PrismCodeBlock to render plain text without syntax highlighting - Plain text code blocks don't add anything after backticks Fixes #3917 Co-authored-by: Sylvain --- .../markdown_editor/initialized_editor.tsx | 15 ++++++++++++++- .../markdown_editor/plugins/code/languages.ts | 6 ++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/front_end/src/components/markdown_editor/initialized_editor.tsx b/front_end/src/components/markdown_editor/initialized_editor.tsx index 3c019f99bf..52efcb96c3 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", From a5ac1d8802d9d01afaa73e1da2da7e01aa941cca Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Fri, 12 Dec 2025 15:18:00 +0000 Subject: [PATCH 2/2] Set plaintext as default language for new code blocks Co-authored-by: Sylvain --- front_end/src/components/markdown_editor/initialized_editor.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front_end/src/components/markdown_editor/initialized_editor.tsx b/front_end/src/components/markdown_editor/initialized_editor.tsx index 52efcb96c3..cbf6038275 100644 --- a/front_end/src/components/markdown_editor/initialized_editor.tsx +++ b/front_end/src/components/markdown_editor/initialized_editor.tsx @@ -269,7 +269,7 @@ const InitializedMarkdownEditor: FC< } return [ ...common, - codeBlockPlugin({ defaultCodeBlockLanguage: "ts" }), + codeBlockPlugin({ defaultCodeBlockLanguage: "text" }), codeMirrorPlugin({ codeBlockLanguages: CANONICAL_TO_LABEL, }),