WebAssembly build of rust lib `pulldown-cmark` for Node.js
npm install @web-alchemy/markdown-wasmpulldown-cmark for Node.js``shell`
npm install @web-alchemy/markdown-wasm
`javascript
import { parse } from '@web-alchemy/markdown-wasm';
const markdownSource = # title
Some text
!some image alt;
const html = parse(markdownSource);
console.log(html)
/*
Some text

Using non standard features
You can use additional (non CommonMark) features via
Options. They work as bit masks.`javascript
import { parse, Flags } from '@web-alchemy/markdown-wasm';const source =
# my todo list { #list-head-id .head-class };const FLAGS = new Flags();
const flags = FLAGS.ENABLE_HEADING_ATTRIBUTES | FLAGS.ENABLE_TASKLISTS;
const html = parse(source, flags);
/*
my todo list
- check 1
- check 2
- check 3
*/
`You can enable all feautures with
FLAGS.ENABLE_ALL flag.Benchmark
Results of benchmark (ops/s):
Development
- Install Node.js
- Install dev dependencies -
npm ci.
- Modify source code in src folder and write tests in test folder.
- Create build - node --run build. pkg folder should contains npm package files.
- Run tests - node --run test`.