極致 快速 的 Markdown 編譯器

使用 Rust 打造的高效能 Markdown / MDX 編譯器。
比 unified 最高快上 25 倍

$npm install @unifast/node

效能測試

Markdown 編譯為 HTML 所需的時間(毫秒),數值越低越好。

120 lines
0.18ms
4.78ms
27x
560 lines
0.41ms
11.22ms
27x
2,000 lines
1.2ms
31.51ms
26x
unifastunified + remark + rehype

你所需要的 API,全部內建。

import { compile } from "@unifast/node";

const result = compile("# Hello\n\nThis is **unifast**.");

console.log(result.output);
// <h1 id="hello">Hello</h1>
// <p>This is <strong>unifast</strong>.</p>

特色

🦀Rust 驅動

核心編譯器以 Rust 撰寫,採用零拷貝解析與 arena 記憶體配置。

🔋功能齊全

內建 20 多種外掛:GFM、數學公式、emoji、語法高亮、frontmatter 等。

🌈雙引擎語法高亮

內建 Tree-sitter 與 syntect,比 rehype-highlight 最高快上 8 倍。

⚛️支援 MDX

一流的 MDX 編譯體驗,完整支援 JSX 與運算式。

贊助者