satorigear
v0.0.9
Published
Blazing fast Markdown parser with full incremental support that outputs MDAST
Readme
奔走も虚しく、技術・流通を手に入れた地霊殿は、兵器の開発に乗り出した。
その兵器の名は——
SatoriGear is a blazing fast markdown parser with full incremental support that outputs MDAST.
It includes built-in support for GFM and MDC syntax and is fully compliant with the CommonMark specification. The plugin API is not yet public.
Installation
pnpm i satorigearUsage
import { createParser } from "satorigear";
const parser = createParser({
features: {
attributes: true,
binding: true,
component: true,
emoji: true,
footnote: true,
frontmatter: true,
math: true,
strikethrough: true,
table: true,
taskList: true,
},
});
// one-shot parse
const mdast = parser.parse("...");
// incremental edit
const document = parser.createDocument("...");
document.edit([
{ start: 66, end: 66, text: ":" },
{ start: 66, end: 66, text: "nuxt-img" },
]);
const mdast = document.tree;Performance
Benchmarked against Sätteri 0.10.5 and Remark ([email protected]), which also produce MDAST, with feature sets kept as equivalent as possible for each profile.
Median of 4 isolated mean-time runs at commit
174fd6con Apple M3, node 26.5.0, arm64-darwin. SatoriGear and Sätteri run in paired AB/BA order; comparisons are normalized to SatoriGear (↑ faster, ↓ slower). Lower time and higher throughput are better.
CommonMark
CommonMark 0.31.2 specification, 205025 bytes, 1 document
| Engine | Mean time | vs. SatoriGear | Throughput | | --- | ---: | ---: | ---: | | SatoriGear | 879 µs | baseline | 222 MiB/s | | Sätteri | 1.19 ms | ↓ 1.35× | 164 MiB/s | | Remark | 62.9 ms | ↓ 71.49× | 3.11 MiB/s |
CommonMark 0.31.2 examples, 14919 bytes, 652 documents
| Engine | Mean time | vs. SatoriGear | Throughput | | --- | ---: | ---: | ---: | | SatoriGear | 546 µs | baseline | 26.0 MiB/s | | Sätteri | 2.21 ms | ↓ 4.05× | 6.42 MiB/s | | Remark | 25.9 ms | ↓ 47.33× | 0.55 MiB/s |
Built-in features
Rust release history, 910115 bytes, 1 document
| Engine | Mean time | vs. SatoriGear | Throughput | | --- | ---: | ---: | ---: | | SatoriGear | 12.9 ms | baseline | 67.4 MiB/s | | Sätteri | 14.9 ms | ↓ 1.16× | 58.2 MiB/s |
Public APIs README, 232580 bytes, 1 document
| Engine | Mean time | vs. SatoriGear | Throughput | | --- | ---: | ---: | ---: | | SatoriGear | 3.02 ms | baseline | 73.4 MiB/s | | Sätteri | 3.95 ms | ↓ 1.31× | 56.2 MiB/s |
