mirror of
https://github.com/pesde-pkg/pesde.git
synced 2024-12-12 19:10:35 +00:00
22 lines
783 B
Diff
22 lines
783 B
Diff
@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;
|