@unifast/node 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 +69 -0
- package/native/unifast.darwin-arm64.node +0 -0
- package/native/unifast.darwin-x64.node +0 -0
- package/native/unifast.linux-arm64-gnu.node +0 -0
- package/native/unifast.linux-x64-gnu.node +0 -0
- package/native/unifast.linux-x64-musl.node +0 -0
- package/native/unifast.win32-x64.node +0 -0
- package/package.json +22 -2
package/LICENSE
CHANGED
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# @unifast/node
|
|
2
|
+
|
|
3
|
+
Node.js binding for [unifast](https://kenzo-pj.github.io/unifast/) — a high-performance Markdown/MDX compiler with a Rust core.
|
|
4
|
+
|
|
5
|
+
One call compiles Markdown to HTML with all features applied. No JS plugin chain overhead.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @unifast/node
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { compile } from "@unifast/node";
|
|
17
|
+
|
|
18
|
+
const result = compile("# Hello, unifast!\n\nThis is **Markdown**.");
|
|
19
|
+
|
|
20
|
+
console.log(result.html);
|
|
21
|
+
// <h1>Hello, unifast!</h1>
|
|
22
|
+
// <p>This is <strong>Markdown</strong>.</p>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### With Plugins
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { compile, frontmatter, gfm, syntect } from "@unifast/node";
|
|
29
|
+
|
|
30
|
+
const result = compile(source, {
|
|
31
|
+
plugins: [frontmatter(), gfm(), syntect()],
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
console.log(result.frontmatter); // { title: "My Post", ... }
|
|
35
|
+
console.log(result.html); // Rendered HTML with GFM + highlighting
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## API
|
|
39
|
+
|
|
40
|
+
### `compile(input, options?)`
|
|
41
|
+
|
|
42
|
+
Compile a Markdown or MDX string.
|
|
43
|
+
|
|
44
|
+
- **`input`** (`string`) — Markdown/MDX source
|
|
45
|
+
- **`options`** (`CompileOptions`) — Compiler options and plugins
|
|
46
|
+
|
|
47
|
+
Returns a `CompileResult`:
|
|
48
|
+
|
|
49
|
+
| Property | Type | Description |
|
|
50
|
+
|----------|------|-------------|
|
|
51
|
+
| `output` | `string \| object` | Compiled output (HTML, HAST, MDAST, or MDX-JS) |
|
|
52
|
+
| `frontmatter` | `Record<string, unknown>` | Extracted frontmatter metadata |
|
|
53
|
+
| `diagnostics` | `Diagnostic[]` | Compilation warnings and errors |
|
|
54
|
+
| `stats` | `{ parseMs, transformMs, emitMs }` | Performance timing |
|
|
55
|
+
| `toc` | `TocEntry[]` | Table of contents entries |
|
|
56
|
+
| `readingTime` | `{ minutes, words }` | Estimated reading time |
|
|
57
|
+
| `excerpt` | `string` | Content before `<!-- more -->` marker |
|
|
58
|
+
|
|
59
|
+
### Built-in Plugins
|
|
60
|
+
|
|
61
|
+
All plugins are included — no separate install needed. All implemented natively in Rust.
|
|
62
|
+
|
|
63
|
+
`gfm`, `frontmatter`, `sanitize`, `syntect`, `treeSitter`, `toc`, `externalLinks`, `autolinkHeadings`, `smartypants`, `wikiLink`, `codeImport`, `emoji`, `breaks`, `math`, `githubAlert`, `sectionize`, `directive`, `definitionList`, `rubyAnnotation`, `cjk`, `codeMeta`, `figure`, `customHeadingId`, `readingTime`, `excerpt`, `abbr`, `commentRemoval`, `imgLazyLoading`, `accessibleEmoji`, `addClasses`, `minify`
|
|
64
|
+
|
|
65
|
+
See the [full plugin documentation](https://github.com/kenzo-pj/unifast#built-in-plugins).
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
[MIT](https://github.com/kenzo-pj/unifast/blob/main/LICENSE)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unifast/node",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Node.js binding for unifast Markdown/MDX compiler",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Kenzo-Wada",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/kenzo-pj/unifast",
|
|
10
|
+
"directory": "packages/node"
|
|
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
|
+
"mdx",
|
|
20
|
+
"compiler",
|
|
21
|
+
"rust",
|
|
22
|
+
"napi",
|
|
23
|
+
"nodejs"
|
|
24
|
+
],
|
|
5
25
|
"files": [
|
|
6
26
|
"dist",
|
|
7
27
|
"native"
|
|
@@ -21,7 +41,7 @@
|
|
|
21
41
|
},
|
|
22
42
|
"dependencies": {
|
|
23
43
|
"deepmerge": "^4.3.1",
|
|
24
|
-
"@unifast/core": "0.0.
|
|
44
|
+
"@unifast/core": "0.0.5"
|
|
25
45
|
},
|
|
26
46
|
"devDependencies": {
|
|
27
47
|
"@types/node": "^25.4.0",
|