mork
Mörk is a Markdown parser for Gleam that should work in both Erlang and Javascript contexts.
The goal is 100% spec compliance with Commonmark, as well as supporting GFM (Github Flavored Markdown) extensions like footnotes.
Current status:
-
All Commonmark spec test are passing
-
on the BEAM
-
on Node.js
-
on Deno
-
NOT on bun:
The Bun runtime currently has a bug that affects gleam programs and makes programs using mork crash. There is (Nov 2025) a PR proposal to fix this: https://github.com/oven-sh/bun/pull/24578
-
-
Footnote references are supported
-
An option to strip YAML frontmatter is available
Values
pub fn configure() -> document.Options
Configure default options for mork.
Example usage:
let doc = mork.configure()
|> mork.strip_frontmatter
|> mork.parse_with_options(markdown)
let html = doc |> mork.to_html
pub fn footnotes(
opt: document.Options,
enable footnotes: Bool,
) -> document.Options
Toggle support for footnote syntax. Note: Footnotes are enabled by default.
pub fn parse(input input: String) -> document.Document
Parse a string containing Markdown into a Document record. Document can be turned into HTML using the to_html function.
import mork
pub fn main() {
let md = "# hello world\n"
let html = md
|> mork.parse
|> mork.to_html
io.print(html)
}
pub fn parse_debug(
md: String,
callback: fn(String) -> Nil,
) -> document.Document
pub fn parse_with_options(
options options: document.Options,
input input: String,
) -> document.Document
Parse a Markdown document into a Document record
with the given options.
For an example on how to use this, see configure.
pub fn strip_frontmatter(
opt: document.Options,
) -> document.Options
Strip YAML frontmatter from the markdown input. See https://jekyllrb.com/docs/front-matter/