mirror of
https://github.com/pesde-pkg/pesde.git
synced 2024-12-12 11:00:36 +00:00
27 lines
770 B
Diff
27 lines
770 B
Diff
|
@shikis/rehype doesn't use the `fallbackLanguage` if `lazy` is used.
|
||
|
|
||
|
--- a/dist/core.mjs
|
||
|
+++ b/dist/core.mjs
|
||
|
@@ -1,6 +1,8 @@
|
||
|
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);
|
||
|
@@ -90,8 +92,12 @@ function rehypeShikiFromHighlighter(highlighter, options) {
|
||
|
const languageQueue = [];
|
||
|
const queue = [];
|
||
|
function getLanguage(lang) {
|
||
|
if (!lang)
|
||
|
return defaultLanguage;
|
||
|
+
|
||
|
+ if (!(lang in bundledLanguages))
|
||
|
+ return fallbackLanguage;
|
||
|
+
|
||
|
if (highlighter.getLoadedLanguages().includes(lang))
|
||
|
return lang;
|
||
|
if (lazy) {
|