From 1640dab0c4253afc359aad747497b729a1c0cf6e Mon Sep 17 00:00:00 2001 From: Luka <47296785+lukadev-0@users.noreply.github.com> Date: Wed, 30 Oct 2024 18:20:24 +0100 Subject: [PATCH] fix(website): shiki fallback language patch (#5) --- website/bun.lockb | Bin 227536 -> 227536 bytes website/package.json | 138 +++++++++--------- ...0.patch => @shikijs%2Frehype@1.22.2.patch} | 16 +- 3 files changed, 75 insertions(+), 79 deletions(-) rename website/patches/{@shikijs%2Frehype@1.22.0.patch => @shikijs%2Frehype@1.22.2.patch} (64%) diff --git a/website/bun.lockb b/website/bun.lockb index fba965974c2595125bddbb1d4e102d4b052b8ecc..f1a7946c04f66624c65d178b403d12963e5b7262 100755 GIT binary patch delta 50 zcmV-20L}l<@eR=N4S<9JgaWh!lXn3!my~w{Lg5I37^|1ycLP`m+{{hJo*0X; ImqDfhkTzfzS^xk5 delta 50 zcmV-20L}l<@eR=N4S<9JgaWh!lXn3ymy~w{L { const raw = toString(node); -@@ -90,8 +92,12 @@ function rehypeShikiFromHighlighter(highlighter, options) { - const languageQueue = []; - const queue = []; - function getLanguage(lang) { - if (!lang) +@@ -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 (highlighter.getLoadedLanguages().includes(lang)) - return lang; if (lazy) { + languageQueue.push(lang); + return lang;