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

Syntax highlighting doesn't work in some language. #3200

Open
fajaralfa opened this issue Feb 26, 2025 · 3 comments
Open

Syntax highlighting doesn't work in some language. #3200

fajaralfa opened this issue Feb 26, 2025 · 3 comments

Comments

@fajaralfa
Copy link

Environment

  • Operating System: Windows_NT
  • Node Version: v22.14.0
  • Nuxt Version: 3.15.4
  • CLI Version: 3.22.2
  • Nitro Version: 2.10.4
  • Package Manager: [email protected]
  • Builder: -
  • User Config: compatibilityDate, devtools, modules, mdc
  • Runtime Modules: @nuxt/[email protected]
  • Build Modules: -

Version

v3.2.2

Reproduction

https://github.com/fajaralfa/using-nuxt

Description

Hi team, thanks for creating Nuxt Content.
But i got problem when trying to write other language (only c++ and python that i test) that the syntax highlighting doesn't work, but when i write a js and vue script it does work.

Image

Additional context

No response

Logs

@fajaralfa fajaralfa changed the title Syntax highlighting doesn't work on all language. Syntax highlighting doesn't work on some language. Feb 26, 2025
@fajaralfa fajaralfa changed the title Syntax highlighting doesn't work on some language. Syntax highlighting doesn't work in some language. Feb 26, 2025
@farnabaz
Copy link
Member

farnabaz commented Feb 26, 2025

I could run your reproduction in Stackblitz and seems fine https://stackblitz.com/edit/github-radbxfy2?file=content%2Findex.md

If it does not work for you, maybe something is broken in Windows. I have some feelings about this line.

typeof lang === 'string' ? await import(`@shikijs/langs/${lang}`).then(m => m.default || m) : lang,

Maybe adding .mjs to end of import helps to resolve the files 🤔

Update: lang import seems fine

@fajaralfa
Copy link
Author

Thanks, i tried to run it in Stackblitz and it does work too.
And then just try to run it again in windows, and the python does highlighted but c++ don't.
So this is windows issue then? is there any workaround?

@farnabaz
Copy link
Member

farnabaz commented Feb 27, 2025

For C++, I think you need to use cpp as language name, have you tried cpp?

So this is windows issue then? is there any workaround?

I don't have fast access to Windows to dig, I'll check with a virtual machine

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