feat: add ToggleGroup

This commit is contained in:
Henry Li
2026-01-19 19:41:46 +08:00
parent 1171598b2f
commit d7dfffad90
9 changed files with 316 additions and 103 deletions

View File

@@ -1,6 +1,13 @@
import type { BundledLanguage } from "shiki";
const extensionMap: Record<string, string> = {
// Text
txt: "text",
csv: "csv",
log: "text",
conf: "text",
config: "text",
properties: "text",
props: "text",
const extensionMap: Record<string, BundledLanguage> = {
// JavaScript/TypeScript ecosystem
js: "javascript",
jsx: "jsx",
@@ -137,14 +144,14 @@ export function getFileExtension(filepath: string) {
export function checkCodeFile(
filepath: string,
):
| { isCodeFile: true; language: BundledLanguage }
| { isCodeFile: true; language: string }
| { isCodeFile: false; language: null } {
const extension = getFileExtension(filepath);
const isCodeFile = extension in extensionMap;
if (isCodeFile) {
return {
isCodeFile: true,
language: extensionMap[extension] as unknown as BundledLanguage,
language: extensionMap[extension] ?? "text",
};
}
return {