feat: 代码片段功能与 Markdown 内嵌片段渲染、文档截图等

This commit is contained in:
2026-10-09 18:53:38 +08:00
parent 5598e1cbb7
commit da72843c70
64 changed files with 7047 additions and 248 deletions

View File

@@ -0,0 +1,48 @@
/** 片段语言霓虹色:Hero 分布条 / 卡片顶条共用,未收录语言回落主题色 */
const LANG_COLORS: Record<string, string> = {
go: "#00d8ff",
css: "#c792ea",
scss: "#e879c6",
html: "#ff6d4d",
javascript: "#f7df1e",
jsx: "#61dafb",
typescript: "#4e9cff",
tsx: "#4e9cff",
vue: "#41d1a6",
python: "#ffd43b",
rust: "#ff7a59",
java: "#ffb86c",
kotlin: "#c87bff",
swift: "#ff9e64",
dart: "#54c5f8",
c: "#7fd4ff",
cpp: "#7fd4ff",
csharp: "#b78bff",
php: "#a6b1ff",
ruby: "#ff5f56",
lua: "#9c9cff",
r: "#7ea6ff",
sql: "#ff9e64",
graphql: "#ff6bd6",
bash: "#89e051",
shell: "#89e051",
powershell: "#6ea8ff",
dockerfile: "#3ab0ff",
nginx: "#5fd08a",
yaml: "#ff6b81",
toml: "#ffd166",
ini: "#ffd166",
json: "#8bc34a",
jsonc: "#8bc34a",
xml: "#ffab70",
markdown: "#9aa7ff",
regex: "#f78c6c",
diff: "#b0bec5",
makefile: "#ffd166",
prisma: "#5eead4",
plaintext: "#94a3b8",
};
export function snippetLangColor(lang: string): string {
return LANG_COLORS[lang.toLowerCase()] ?? "var(--accent)";
}