@shikijs/markdown-it: code block is wrong when entering a non-existent language
Only566 opened this issue · comments
Olnyhhhh commented
Validations
- Follow our Code of Conduct
- Read the Contributing Guide.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Describe the bug
Code block is wrong when entering a non-existent language, even if the input is not complete, an error will be reported.
Allowing configuration of a default language during initialization may be a good solution.
MarkdownItPluginShiki({
defaultLang: 'text'
})
Reproduction
Contributes
- I am willing to submit a PR to fix this issue
- I am willing to submit a PR with failing tests
Anthony Fu commented
PR welcome :)
Ryan Glover commented
This can be resolved if you add a fallbackLanguage
to the options like so:
md.use(await Shiki({
fallbackLanguage: 'javascript',
defaultLanguage: 'javascript',
themes: {
light: 'slack-ochin',
}
}));
Just tested against latest v1.6.2 release and can confirm it falls back as expected when you have non-existent language (or a typo in the language name).