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

Languages provided to the highlighter.codeToHtml() function are case-sensitive #487

Closed
Masstronaut opened this issue Jun 20, 2023 · 1 comment

Comments

@Masstronaut
Copy link
Contributor

Masstronaut commented Jun 20, 2023

highlighter.codeToHtml(code, { lang: 'yaml' }) works fine, but these both fail:

  • highlighter.codeToHtml(code, { lang: 'Yaml' })
  • 'highlighter.codeToHtml(code, { lang: 'YAML' })'

I can fix this on my end now that I know what the issue is, though it seems a bit silly to have the highlighter throw if the only issue is casing of the language.

Would you be open to approving a PR to that runs .toLowerCase() to solve this issue, or is throwing in this scenario the desired/intended behavior for the project?

@antfu
Copy link
Member

antfu commented Jan 26, 2024

I believe this is the intended behavior. It's better to normalize your language id before passing in.

@antfu antfu closed this as not planned Won't fix, can't repro, duplicate, stale Jan 26, 2024
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