Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(markdown): resolve custom shiki languages #1692

Merged
merged 2 commits into from
Nov 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/runtime/server/api/highlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export const logger = consola.withScope('@nuxt/content')
*
* Used to resolve lang from both languages id's and aliases.
*/
const resolveLang = (lang: string): Lang | undefined =>
BUNDLED_LANGUAGES.find(l => l.id === lang || l.aliases?.includes(lang))?.id as Lang
const resolveLang = (lang: string): Lang =>
(BUNDLED_LANGUAGES.find(l => l.id === lang || l.aliases?.includes(lang))?.id || lang) as Lang

/**
* Resolve Shiki compatible theme from string.
Expand Down Expand Up @@ -79,7 +79,7 @@ export default lazyEventHandler(async () => {
id: 'md',
scopeName: 'text.markdown.mdc',
path: 'mdc.tmLanguage.json',
aliases: ['markdown'],
aliases: ['markdown', 'md', 'mdc'],
grammar: mdcTMLanguage
}
] as any[]
Expand Down