Skip to content

R code highlighting error #1432

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

Closed
jsandblom opened this issue Aug 10, 2022 · 4 comments · Fixed by #1436
Closed

R code highlighting error #1432

jsandblom opened this issue Aug 10, 2022 · 4 comments · Fixed by #1436

Comments

@jsandblom
Copy link

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. (./node_modules/shiki-es/dist/shiki.mjs:12:25495)
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

@jsandblom
Copy link
Author

Sorry, I assumed the text in "Reproduction" would not be formatted. The first language block should obviously be "js" and the second "r".

@jsandblom
Copy link
Author

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

@Benbinbin
Copy link
Contributor

you should setting the highlight language at nuxt.config.ts

check this issue for more detail

this is the live demo

@jsandblom
Copy link
Author

Indeed! Thank you. This was however not easily seen in the documentation.

Johan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants