Repository navigation
react-shiki@0.11.1
Patch Changes
-
Fix: case-insensitive matching for language aliases.
#1842484f24@aouxwoux -
Fix(css): three default-style selectors left part of the selector outside
:where()(pre, language label, highlighted line), giving them real specificity that could tie with or beat user rules depending on stylesheet order. All selectors are now fully wrapped and zero-specificity, so any user rule always wins.#185607be76@AVGVSTVS96 -
Feat:
preloadLanguagesnow accepts dynamic grammar imports (shiki'sLanguageInput) on the full and web bundles, so custom grammars can stay code-split instead of shipping in the main bundle:#193530d033@AVGVSTVS96const preload = [() => import("../langs/mcfunction.tmLanguage.json")]; <ShikiHighlighter language="mcfunction" preloadLanguages={preload}> {code} </ShikiHighlighter>;
Promises, getters, and module objects are all accepted and resolved by shiki during highlighter setup. Define them at module scope, preferring the getter form: a fresh arrow function on every render re-triggers highlighting, while swapping a bare promise at runtime is not detected. Additive only: strings and grammar objects work exactly as before.
-
Feat: add named engines.
enginenow accepts'javascript'or'oniguruma'alongside engine instances.#1925f94c02@AVGVSTVS96- Named engines are created, cached, and lazy-loaded internally;
'javascript'skips the WASM fetch entirely - Referentially stable, so safe to pass inline without re-triggering highlighting on rerenders
- Engine instances are still accepted for custom configuration; create them once at module scope
Heads up: the next minor release will swap the default engine from Oniguruma WASM to the JavaScript engine (with
forgivingenabled by default, see shiki/regex-engines). - Named engines are created, cached, and lazy-loaded internally;
-
Fix: removed the hardcoded
id="language-label"from the language label. Pages with multiple code blocks rendered duplicate ids (invalid HTML, andgetElementByIdonly ever found the first label). Style the label with the.rs-language-labelclass or[data-slot="language-label"]instead of#language-label.#1909b73990@AVGVSTVS96 -
Fix: styles are embedded in the JS and install automatically at runtime (as before 0.10.0), no CSS import or bundler configuration needed. Fixes styles dropped from webpack production builds,
ERR_UNKNOWN_FILE_EXTENSIONcrashes in plain Node ESM, and broken no-bundler/CDN usage.react-shiki/cssstill exports the complete compiled stylesheet for build-time CSS pipelines.#1886ef68a3@AVGVSTVS96