From b520757525636d17f74960401869bf164a00961b Mon Sep 17 00:00:00 2001 From: kaventro <301901286+kaventro@users.noreply.github.com> Date: Thu, 3 Dec 2026 14:10:03 +0100 Subject: [PATCH] fix(editor): open xhtml files as HTML --- src/cm/supportedModes.ts | 2 ++ tests/unit/modelist.test.js | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/cm/supportedModes.ts b/src/cm/supportedModes.ts index f16746a74..23b51840e 100644 --- a/src/cm/supportedModes.ts +++ b/src/cm/supportedModes.ts @@ -264,6 +264,8 @@ for (const lang of languages as readonly LanguageDescription[]) { filenames.push("Cargo.lock", "poetry.lock"); } else if (normalizedName === "protobuf" || modeId === "protobuf") { langExtensions.push("pb"); + } else if (normalizedName === "html") { + langExtensions.push("xhtml", "xht"); } const parts: string[] = []; diff --git a/tests/unit/modelist.test.js b/tests/unit/modelist.test.js index 612dacfcb..bfa85cda3 100644 --- a/tests/unit/modelist.test.js +++ b/tests/unit/modelist.test.js @@ -170,6 +170,10 @@ describe("getModeForPath", () => { expect(syntax).toContain("Table"); }); + it.each(["page.xhtml", "page.xht"])("opens %s as HTML", (path) => { + expect(getModeForPath(path).name).toBe("html"); + }); + it("matches the previous sort-and-scan result for built-in modes", () => { const paths = collectParityPaths(); expect(paths.length).toBeGreaterThan(100);