@ugoku/shiki 0.1.0 → 0.1.1
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/CHANGELOG.md +7 -0
- package/README.md +27 -0
- package/package.json +1 -1
package/CHANGELOG.md
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# @ugoku/shiki
|
|
2
|
+
|
|
3
|
+
The build-time [Shiki](https://shiki.style/) transformer for [ugoku](https://github.com/ugokujs/ugoku). Reads a code fence's meta string and, for `run`/`run edit` blocks, stamps the rendered `<pre>` with data attributes `@ugoku/core` reads at runtime (mode, language, theme(s), source hash). Blocks without `run` are left untouched.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { ugokuTransformer } from '@ugoku/shiki';
|
|
9
|
+
|
|
10
|
+
const transformer = ugokuTransformer();
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Pass it wherever your Shiki setup accepts transformers — e.g. VitePress's `markdown.codeTransformers`, or Shiki's own `codeToHtml({ transformers: [...] })`.
|
|
14
|
+
|
|
15
|
+
In markdown, add `run` (run-only) or `run edit` (editable) to the fence info string, alongside whatever else your pipeline already parses there (line numbers, filenames, etc.):
|
|
16
|
+
|
|
17
|
+
````md
|
|
18
|
+
```js run
|
|
19
|
+
console.log('hello');
|
|
20
|
+
```
|
|
21
|
+
````
|
|
22
|
+
|
|
23
|
+
## Who should use this directly
|
|
24
|
+
|
|
25
|
+
If you're using the VitePress or Astro adapter, it already wires this in for you — see [`@ugoku/vitepress`](https://www.npmjs.com/package/@ugoku/vitepress) or [`@ugoku/astro`](https://www.npmjs.com/package/@ugoku/astro). Use this package directly only if you're building a custom Shiki integration.
|
|
26
|
+
|
|
27
|
+
See the [main README](https://github.com/ugokujs/ugoku#readme) for the full picture.
|