R code highlighting error
Environment
Nuxt CLI v3.0.0-rc.6
RootDir: /workspaces/js-n3
Nuxt project info:
- Operating System:
Linux - Node Version:
v16.14.2 - Nuxt Version:
3.0.0-rc.6 - Package Manager:
[email protected] - Builder:
vite - User Config:
modules,content - Runtime Modules:
@nuxt/[email protected] - Build Modules:
-
Reproduction
Try the following on https://content.nuxtjs.org/playground
const a = 'javascript works great'
r <- 'R does not'
Describe the bug
R code is not highlighted. I could not find any console messages in the playground, but on github codespaces I get lots of
[nuxt] [request error] No grammar provided for <source.r>
at Registry.e._collectDependenciesForDep (./node_modules/shiki-es/dist/shiki.mjs:12:24999)
at Registry.
at ./node_modules/shiki-es/dist/shiki.mjs:12:23016
at Object.next (./node_modules/shiki-es/dist/shiki.mjs:12:23125)
at s (./node_modules/shiki-es/dist/shiki.mjs:12:21828)
[nuxt] [request error] 500 Internal Server Error (/api/_content/highlight)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async highlightBlock (./.nuxt/dev/index.mjs:2633:17)
at async Promise.all (index 0)
at async Object.transform (./.nuxt/dev/index.mjs:2602:5)
at async parseContent (./.nuxt/dev/index.mjs:2666:18)
at async getContent (./.nuxt/dev/index.mjs:2745:18)
at async Promise.all (index 0)
at async getContentsList (./.nuxt/dev/index.mjs:2715:20)
at async ./.nuxt/dev/index.mjs:541:18
at async ./.nuxt/dev/index.mjs:2830:20
Additional context
No response
Logs
No response
Sorry, I assumed the text in "Reproduction" would not be formatted. The first language block should obviously be "js" and the second "r".
Also I should mention that shiki appears not to be to blame, as R code is properly highlighted here: https://codesandbox.io/s/shiki-next-js-forked-jc1yuc?file=/pages/index.js
you should setting the highlight language at nuxt.config.ts
check this issue for more detail
this is the live demo
Indeed! Thank you. This was however not easily seen in the documentation.
Johan