You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The main `shikiji` entries bundles all supported themes and languages via lazy dynamic imports. The efficiency shouldn't be a concern to most of the scenarios as the grammar would only be imported/downloaded when it is used. However, when you bundle Shikiji into browsers runtime or web workers, even those files are not imported, they still add up to your dist size. We provide the [fine-grained bundle](/guide/install#fine-grained-bundle) to help you compose languages and themes one-by-one as you need.
8
+
9
+
To make it easier, we also provide some pre-composed bundles for you to use:
10
+
11
+
## `shikiji/bundle/full`
12
+
13
+
The full bundle includes all themes and languages, same as the main `shikiji` entry.
14
+
15
+
## `shikiji/bundle/web`
16
+
17
+
The bundle the includes all themes and common web languages like (HTML, CSS, JS, TS, JSON, Markdown, etc.) and some web frameworks (Vue, JSX, Svelte, etc.).
18
+
19
+
Use as normal, all functions from `shikiji` are also available in the bundle:
We also provide some pre-composed bundles for you to use easily, learn more about them in the [bundles section](/guide/bundles).
132
+
129
133
### CJS Usage
130
134
131
135
`shikiji` is published as ESM-only to reduce the package size. It's still possible to use it in CJS, as Node.js supports importing ESM modules dynamically in CJS.
@@ -138,7 +142,7 @@ import { getHighlighter } from 'shikiji'
138
142
139
143
asyncfunctionmain() {
140
144
constshiki=awaitgetHighlighter({
141
-
themes: ['nord'],
145
+
themes: ['vitesse-dark'],
142
146
langs: ['javascript'],
143
147
})
144
148
@@ -154,7 +158,7 @@ async function main() {
154
158
const { getHighlighter } =awaitimport('shikiji')
155
159
156
160
constshiki=awaitgetHighlighter({
157
-
themes: ['nord'],
161
+
themes: ['vitesse-dark'],
158
162
langs: ['javascript'],
159
163
})
160
164
@@ -166,7 +170,7 @@ async function main() {
166
170
167
171
To use `shikiji` in the browser via CDN, you can use [esm.run](https://esm.run) or [esm.sh](https://esm.sh).
168
172
169
-
```html
173
+
```html theme:rose-pine
170
174
<body>
171
175
<divid="foo"></div>
172
176
@@ -177,7 +181,10 @@ To use `shikiji` in the browser via CDN, you can use [esm.run](https://esm.run)
177
181
// import { codeToHtml } from 'https://esm.run/shikiji@0.8.0'
178
182
179
183
constfoo=document.getElementById('foo')
180
-
foo.innerHTML=awaitcodeToHtml('console.log("Hi, Shiki on CDN :)")', { lang:'js', theme:'vitesse-light' })
184
+
foo.innerHTML=awaitcodeToHtml('console.log("Hi, Shiki on CDN :)")', {
185
+
lang:'js',
186
+
theme:'rose-pine'
187
+
})
181
188
</script>
182
189
</body>
183
190
```
@@ -192,7 +199,7 @@ Cloudflare Workers [does not support initializing WebAssembly from binary data](
192
199
193
200
Meanwhile, it's also recommended to use the [Fine-grained Bundle](#fine-grained-bundle) approach to reduce the bundle size.
0 commit comments