@devries-cameron20 / t3code Mirror · read-only / commits / b665f0b11c
Fork 0

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 22, 12:00 UTC

fix(web): recognize plain text aliases in code fences (#23446)

Co-authored-by: GPT-6.1 Sol <noreply@openai.com>

Victor Vogel committed Oct 30, 2026 at 15:49 UTC b665f0b11c351935bea5aa633416f9a32c9c6b08
2 files changed +15 -1
apps/web/src/composer-code-languages.test.ts new
+11
@@ -0,0 +1,11 @@
1 +import { expect, it } from "vite-plus/test";
2 +
3 +import { codeLanguageEntry, languageOfInfoString } from "./composer-code-languages";
4 +
5 +it("recognizes plain-text fence info strings without treating metadata as the language", () => {
6 + const entries = ["Text", "TEXT", "plaintext", "txt"].map((language) =>
7 + codeLanguageEntry(languageOfInfoString(` ${language} title=notes.txt`)),
8 + );
9 +
10 + expect(entries).toEqual(Array.from({ length: 4 }, () => ({ id: "", label: "Plain text" })));
11 +});
apps/web/src/composer-code-languages.ts
+4 -1
@@ -47,12 +47,15 @@ const LANGUAGE_ALIASES: Record<string, string> = {
47 "c++": "cpp",
48 js: "javascript",
49 md: "markdown",
50 + plaintext: "",
51 py: "python",
52 rb: "ruby",
53 rs: "rust",
54 sh: "bash",
55 shell: "bash",
56 + text: "",
57 ts: "typescript",
58 + txt: "",
59 yml: "yaml",
60 };
61
@@ -69,7 +72,7 @@ export function withInfoStringLanguage(info: string, language: string): string {
72 }
73
74 export function codeLanguageEntry(language: string): CodeBlockLanguage | null {
72 - const id = language === "text" ? "" : (LANGUAGE_ALIASES[language.toLowerCase()] ?? language);
75 + const id = LANGUAGE_ALIASES[language.toLowerCase()] ?? language;
76 return CODE_BLOCK_LANGUAGES.find((entry) => entry.id === id.toLowerCase()) ?? null;
77 }
78