Skip to content

Commit 5824623

Browse files
authored
Add mts and cts file extension aliases (#2936)
Resolves #2936
1 parent 911faff commit 5824623

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ title: Changelog
88

99
- `@inline` now functions when referencing tuple types, #2932.
1010
- `@link` links to the current page are now rendered, #2934.
11+
- `@includeCode` now supports regions in TypeScript files with `.mts` and `.cts` file extensions, #2935.
1112
- Aliased symbols (re-exports) are now resolved before checking if they are excluded/external, #2937.
1213

1314
## v0.28.2 (2025-04-07)

src/lib/converter/plugins/IncludePlugin.ts

+2
Original file line numberDiff line numberDiff line change
@@ -428,3 +428,5 @@ regionTagREsByExt["php"] = regionTagREsByExt["cs"];
428428
regionTagREsByExt["ps1"] = regionTagREsByExt["cs"];
429429
regionTagREsByExt["py"] = regionTagREsByExt["cs"];
430430
regionTagREsByExt["js"] = regionTagREsByExt["ts"];
431+
regionTagREsByExt["mts"] = regionTagREsByExt["ts"];
432+
regionTagREsByExt["cts"] = regionTagREsByExt["ts"];

src/lib/utils/highlighter.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import * as shiki from "@gerrit0/mini-shiki";
22
import { JSX, unique } from "#utils";
33
import assert from "assert";
44

5-
const aliases = new Map<string, string>();
5+
const tsAliases: [string, string][] = [["mts", "typescript"], ["cts", "typescript"]];
6+
const aliases = new Map<string, string>(tsAliases);
67
for (const lang of shiki.bundledLanguagesInfo) {
78
for (const alias of lang.aliases || []) {
89
aliases.set(alias, lang.id);
@@ -175,7 +176,7 @@ export function getSupportedThemes(): string[] {
175176

176177
export function isLoadedLanguage(lang: string): boolean {
177178
return (
178-
plaintextLanguages.includes(lang) || ignoredLanguages?.includes(lang) || highlighter?.supports(lang) || false
179+
isSupportedLanguage(lang) || highlighter?.supports(lang) || false
179180
);
180181
}
181182

0 commit comments

Comments
 (0)