@unifast/shiki 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +52 -0
- package/package.json +20 -2
package/LICENSE
CHANGED
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# @unifast/shiki
|
|
2
|
+
|
|
3
|
+
[Shiki](https://shiki.style/) syntax highlighting plugin for [unifast](https://kenzo-pj.github.io/unifast/).
|
|
4
|
+
|
|
5
|
+
Transforms code blocks in the HAST output using Shiki's TextMate grammar-based highlighter with support for dual themes (light/dark).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @unifast/shiki @unifast/node
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { compile } from "@unifast/node";
|
|
17
|
+
import { createShikiPlugin } from "@unifast/shiki";
|
|
18
|
+
|
|
19
|
+
const shiki = await createShikiPlugin({
|
|
20
|
+
themes: {
|
|
21
|
+
light: "github-light",
|
|
22
|
+
dark: "github-dark",
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const result = compile(markdown, {
|
|
27
|
+
plugins: [shiki],
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## API
|
|
32
|
+
|
|
33
|
+
### `createShikiPlugin(options?)`
|
|
34
|
+
|
|
35
|
+
Create a unifast plugin for Shiki syntax highlighting. Returns a `Promise<UnifastPlugin>`.
|
|
36
|
+
|
|
37
|
+
**Options:**
|
|
38
|
+
|
|
39
|
+
| Option | Type | Description |
|
|
40
|
+
|--------|------|-------------|
|
|
41
|
+
| `themes` | `BundledTheme \| BundledTheme[] \| { light, dark }` | Theme(s) to use |
|
|
42
|
+
| `defaultTheme` | `BundledTheme` | Fallback theme |
|
|
43
|
+
| `defaultColor` | `string \| false` | Default color for highlighted tokens |
|
|
44
|
+
| `langs` | `BundledLanguage[]` | Languages to load |
|
|
45
|
+
|
|
46
|
+
### `createShikiTransformer(options?)`
|
|
47
|
+
|
|
48
|
+
Lower-level API that returns a transformer with `transform(hast)` and `transformMdxJs(js)` methods.
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
[MIT](https://github.com/kenzo-pj/unifast/blob/main/LICENSE)
|
package/package.json
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unifast/shiki",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Shiki syntax highlighting plugin for unifast via HAST transforms",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Kenzo-Wada",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/kenzo-pj/unifast",
|
|
10
|
+
"directory": "packages/shiki"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://kenzo-pj.github.io/unifast/",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/kenzo-pj/unifast/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"unifast",
|
|
18
|
+
"markdown",
|
|
19
|
+
"syntax-highlighting",
|
|
20
|
+
"shiki",
|
|
21
|
+
"hast"
|
|
22
|
+
],
|
|
5
23
|
"files": [
|
|
6
24
|
"dist"
|
|
7
25
|
],
|
|
@@ -20,7 +38,7 @@
|
|
|
20
38
|
},
|
|
21
39
|
"dependencies": {
|
|
22
40
|
"shiki": "^3.23.0",
|
|
23
|
-
"@unifast/core": "0.0.
|
|
41
|
+
"@unifast/core": "0.0.5"
|
|
24
42
|
},
|
|
25
43
|
"devDependencies": {
|
|
26
44
|
"typescript": "^5.9.3",
|