Skip to content

the highlighter not support scss language,and caused the crash #1225

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
flik1337 opened this issue Jun 7, 2022 · 2 comments
Closed

the highlighter not support scss language,and caused the crash #1225

flik1337 opened this issue Jun 7, 2022 · 2 comments

Comments

@flik1337
Copy link

flik1337 commented Jun 7, 2022

Environment

  • Operating System: Darwin
  • Node Version: v16.15.0
  • Nuxt Version: 3.0.0-rc.3
  • Package Manager: [email protected]
  • Builder: vite
  • User Config: modules, styleResources, css, content, colorMode
  • Runtime Modules: @nuxt/[email protected], @nuxtjs/[email protected]
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-eqvgm9?file=content%2Findex.md

Describe the bug

Scss language is supported by shiki, however it is not supported by content module.

In the given reproduction, it is not working when highlight the scss code blcok . It works after changing scss to css.

I think it is caused by the shiki version ,which needs to be upgraded from 0.10.0 to 0.10.1.

Not matter what language is not supported , it should't caused the crash.

Additional context

No response

Logs

[request error] No grammar provided for <source.css.scss>
  at Registry.e._collectDependenciesForDep (./node_modules/shiki-es/dist/shiki.mjs:34:24999)  
  at Registry.eval (./node_modules/shiki-es/dist/shiki.mjs:34:25495)  
  at eval (./node_modules/shiki-es/dist/shiki.mjs:34:23016)  
  at Object.eval [as next] (./node_modules/shiki-es/dist/shiki.mjs:34:23125)  
  at s (./node_modules/shiki-es/dist/shiki.mjs:34:21828)
@farnabaz
Copy link
Member

farnabaz commented Jun 7, 2022

This is an upstream issue shikijs/shiki#257

Meanwhile, you can preload scss and other languages that you wish to use, using content.highlight.preload in nuxt.config

defineNuxtConfig({
  content: {
    highlight: {
      preload: ['css', 'scss', 'js', 'ts']
    }
  }
})

@flik1337
Copy link
Author

flik1337 commented Jun 7, 2022

Thank you so much @farnabaz
I have viewed that issue when this error encountered, but that issue seems not to be fixed.
The content.highlight.preload is still not working for me after I try some times.
I have changed the highlight plugin from shiki to highlight.js and I am waiting for this issue to be fixed.
Thank you again for your time.

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

No branches or pull requests

2 participants