@shikis/rehype doesn't use the `fallbackLanguage` if `lazy` is used. --- a/dist/core.mjs +++ b/dist/core.mjs @@ -2,6 +2,8 @@ import { isSpecialLang } from 'shiki/core'; import { visit } from 'unist-util-visit'; import { toString } from 'hast-util-to-string'; +import { bundledLanguages } from 'shiki'; + const InlineCodeHandlers = { "tailing-curly-colon": (_tree, node) => { const raw = toString(node); @@ -95,6 +97,8 @@ function rehypeShikiFromHighlighter(highlighter, options) { return defaultLanguage; if (highlighter.getLoadedLanguages().includes(lang) || isSpecialLang(lang)) return lang; + if (!(lang in bundledLanguages)) + return fallbackLanguage; if (lazy) { languageQueue.push(lang); return lang;