rusty_markdown
Deno bindings for pulldown-cmark
, a CommonMark-compliant Markdown parser
made in Rust, compiled to WebAssembly. Also supports parsing YAML frontmatter.
Example
import { parse } from "https://deno.land/x/rusty_markdown@v0.1.0/mod.ts";
console.log(parse("Hello **World**!"));
// { parsed: "<p>Hello <strong>World</strong>!</p>" }
console.log(parse("Hello ~~Friends~~ **World**!", { strikethrough: true }));
// { parsed: "<p>Hello <del>Friends</del> <strong>World</strong>!</p>" }
console.log(parse("---\nfoo: bar\n---\nHello **World**!", { frontmatter: true }));
// { parsed: "<p>Hello <strong>World</strong>!</p>", frontmatter: { foo: "bar" } }
Repo Structure
The files in the pkg
directory are generated by scripts/build.ts
, and
contain the webassembly code, compressed and encoded into base64, alongside
boilerplate js generated by wasm-bindgen
for interacting with it. If you want
to build it yourself, you will need to make sure you have wasm-bindgen-cli
installed, and you are using the same version as the one in Cargo.toml
.