@unifast/highlight 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 +37 -0
- package/package.json +21 -2
package/LICENSE
CHANGED
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# @unifast/highlight
|
|
2
|
+
|
|
3
|
+
[highlight.js](https://highlightjs.org/) (via [lowlight](https://github.com/wooorm/lowlight)) syntax highlighting plugin for [unifast](https://kenzo-pj.github.io/unifast/).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @unifast/highlight @unifast/node
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { compile } from "@unifast/node";
|
|
15
|
+
import { highlight } from "@unifast/highlight";
|
|
16
|
+
|
|
17
|
+
const result = compile(markdown, {
|
|
18
|
+
plugins: [highlight()],
|
|
19
|
+
});
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Code blocks with a language class (e.g., ` ```js `) are automatically highlighted. Unknown languages are left untouched.
|
|
23
|
+
|
|
24
|
+
## API
|
|
25
|
+
|
|
26
|
+
### `highlight()`
|
|
27
|
+
|
|
28
|
+
Create a unifast plugin for lowlight-based syntax highlighting. Returns a `UnifastPlugin`.
|
|
29
|
+
|
|
30
|
+
The plugin:
|
|
31
|
+
- Disables unifast's built-in highlighting
|
|
32
|
+
- Transforms `<pre><code>` blocks in the HAST output
|
|
33
|
+
- Supports all languages included in highlight.js
|
|
34
|
+
|
|
35
|
+
## License
|
|
36
|
+
|
|
37
|
+
[MIT](https://github.com/kenzo-pj/unifast/blob/main/LICENSE)
|
package/package.json
CHANGED
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unifast/highlight",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "highlight.js 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/highlight"
|
|
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
|
+
"highlight.js",
|
|
21
|
+
"lowlight",
|
|
22
|
+
"hast"
|
|
23
|
+
],
|
|
5
24
|
"files": [
|
|
6
25
|
"dist"
|
|
7
26
|
],
|
|
@@ -20,7 +39,7 @@
|
|
|
20
39
|
},
|
|
21
40
|
"dependencies": {
|
|
22
41
|
"lowlight": "^3.3.0",
|
|
23
|
-
"@unifast/core": "0.0.
|
|
42
|
+
"@unifast/core": "0.0.5"
|
|
24
43
|
},
|
|
25
44
|
"devDependencies": {
|
|
26
45
|
"typescript": "^5.9.3",
|