Very fast Markdown parser and HTML generator implemented in WebAssembly, based on md4c
Very fast Markdown parser and HTML generator implemented in WebAssembly, based on md4c
Very fast Markdown parser & HTML renderer implemented in WebAssembly
In NodeJS, single file with embedded compressed WASM
const markdown = require("./dist/markdown.node.js")
console.log(markdown.parse("# hello\n*world*"))ES module with WASM loaded separately
import * as markdown from "./dist/markdown.es.js"
await markdown.ready
console.log(markdown.parse("# hello\n*world*"))Web browser
<script src="markdown.js"></script>
<script>
window["markdown"].ready.then(markdown => {
console.log(markdown.parse("# hello\n*world*"))
})
</script>npm install markdown-wasmThe test/benchmark directory contain a benchmark suite which you can
run yourself. It tests a few popular markdown parser-renderers by parsing & rendering a bunch
of different sample markdown files.
The following results were samples on a 2.9 GHz MacBook running macOS 10.15, NodeJS v14.11.0
Ops/second represents how many times a library is able to parse markdown and render HTML during a second, on average across all sample files.
Throughput is the average amount of markdown data processed during a second while both parsing and rendering to HTML. The statistics does not include HTML generated but only bytes of markdown source text parsed.
This graph shows the spread between the fastest and slowest parse-and-render operations for each library. Lower numbers are better.
See test/benchmark for more information.
…See markdown.d.ts
npm install
npx wasmcBuild debug version of markdown into ./build/debug and watch source files:
npx wasmc -g -wIf you need special builds, like for example an ES module with embedded WASM,
edit the wasmc.js file and add module({...}) directives.
Example:
module({ ...m,
name: "markdown-custom",
out: outdir + "/markdown.custom.js",
embed: true,
format: "es",
})No open issues yet, or sync has not completed.