Offline usage, bundle or otherwise
Hi,
I used shiki in the past, relying on [email protected] via esm.sh thanks to which I got highlighter.codeToTokens() and was able to do syntax highlighting in VR.
I tried few times to get it to work offline but without success, namely :
- there is no section in installation, there are numerous CDN and integrations, e.g. Codegen, Nuxt, etc but not "just" a local index.html in CJS
- there is bundle section https://github.com/shikijs/shiki/blob/v3/docs/guide/install.md#bundle-presets but I do not understand how to actually download or build them
- there is an open discussion but no participation https://github.com/shikijs/shiki/discussions/993
So I downloaded the latest repository, built using a container (to insure node and pnpm were latest), and got a ~60MB packages directory with shiki, core and the bundles in.
If I try to load it it directly in a bare index.html (behind HTTPS but not nodejs, build system, etc) I get bare identifier missing. I tried with an importMap but then a lot of dependencies still seem to be missing, e.g. zwitch, hast-util-to-html, etc an unknown number more.
Clearly I'm not doing something right. How can I use Shiki offline?
Source: shikijs/shiki