Skip to content

Commit 4f69470

Browse files
committed
codeblock fixes
1 parent b129e2e commit 4f69470

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/components/markdown/CodeBlock.tsx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ const LANG_ALIASES: Record<string, string> = {
1515
shell: 'bash',
1616
console: 'bash',
1717
zsh: 'bash',
18+
cmd: 'bash',
1819
md: 'markdown',
1920
txt: 'plaintext',
2021
text: 'plaintext',
22+
yml: 'yaml',
23+
json5: 'jsonc',
2124
}
2225

2326
// Lazy highlighter singleton
@@ -40,6 +43,17 @@ async function getHighlighter(language: string) {
4043
'css',
4144
'markdown',
4245
'plaintext',
46+
'toml',
47+
'yaml',
48+
'sql',
49+
'diff',
50+
'vue',
51+
'svelte',
52+
'scss',
53+
'jsonc',
54+
'vue-html',
55+
'angular-html',
56+
'angular-ts',
4357
],
4458
})
4559
}
@@ -111,11 +125,7 @@ export function CodeBlock({
111125
const childElement = props.children as
112126
| undefined
113127
| { props?: { className?: string; children?: string } }
114-
let lang = childElement?.props?.className?.replace('language-', '')
115-
116-
if (lang === 'diff') {
117-
lang = 'plaintext'
118-
}
128+
const lang = childElement?.props?.className?.replace('language-', '')
119129

120130
const children = props.children as
121131
| undefined

0 commit comments

Comments
 (0)