We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Darwin
v18.18.2
3.7.4
3.9.0
2.6.3
[email protected]
-
modules
runtimeConfig
routeRules
image
content
@nuxt/[email protected]
@nuxtjs/[email protected]
https://stackblitz.com/edit/github-thwkf4?file=content%2Findex.md
It seems that we can no longer add custom code highlight grammars. We used to be able to via nuxt.config.ts:
nuxt.config.ts
// https://nuxt.com/docs/api/configuration/nuxt-config import { readFileSync } from 'fs' export default defineNuxtConfig({ modules: ['@nuxt/content', '@nuxtjs/tailwindcss', '@nuxt/image'], content: { highlight: { theme: 'github-dark-dimmed', preload: [ { id: 'gdscript', scopeName: 'source.gdscript', grammar: JSON.parse( readFileSync( './shiki/languages/gdscript.tmLanguage.json', ).toString(), ), aliases: ['gd', 'gdscript'], }, ], }, }, })
When have the exact config above now, you get no syntax highlighting. A TypeScript error in the nuxt.config.ts file says:
Type '{ id: string; scopeName: string; grammar: any; aliases: string[]; }' is not assignable to type 'Lang'.ts(2322)
I tried hunting down why this is happening but wasn't able to find much out. Just wanted to log it.
If this is no longer supported, you might want to remove it from the docs.
No response
The text was updated successfully, but these errors were encountered:
After some digging: it is expected to add the tmLanguage JSON directly into the preload-array instead of { id: 'gdscript', grammer: ... }.
preload
{ id: 'gdscript', grammer: ... }
Example:
// https://nuxt.com/docs/api/configuration/nuxt-config import { readFileSync } from 'fs' export default defineNuxtConfig({ modules: ['@nuxt/content', '@nuxtjs/tailwindcss', '@nuxt/image'], content: { highlight: { theme: 'github-dark-dimmed', preload: [ JSON.parse(fs.readFileSync('./shiki/languages/gdscript.tmLanguage.json', 'utf-8')) ], }, }, })
The preload variable is passed into langs of Shikiji: https://github.com/nuxt-modules/mdc/blob/e744cd341799372ca0a631403809417de9640750/src/runtime/shiki/highlighter.ts#L18
You can read the docs about langs here: https://github.com/antfu/shikiji#fine-grained-bundle
langs
Sorry, something went wrong.
@GerardSmit yeah, good on you. That seems to have done it.
No branches or pull requests
Environment
Darwin
v18.18.2
3.7.4
3.9.0
2.6.3
[email protected]
-
modules
,runtimeConfig
,routeRules
,image
,content
@nuxt/[email protected]
,@nuxtjs/[email protected]
,@nuxt/[email protected]
-
Reproduction
https://stackblitz.com/edit/github-thwkf4?file=content%2Findex.md
Describe the bug
It seems that we can no longer add custom code highlight grammars. We used to be able to via
nuxt.config.ts
:When have the exact config above now, you get no syntax highlighting. A TypeScript error in the
nuxt.config.ts
file says:I tried hunting down why this is happening but wasn't able to find much out. Just wanted to log it.
If this is no longer supported, you might want to remove it from the docs.
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: