mork
MÖRK is a Markdown parser written in pure Gleam, with the ambition to be 100% spec compliant with Commonmark and eventually to implement all of the GFM Markdown extensions as well.
It has mainly been developed for the Erlang compilation target, but is tested against and should work for both Node.js and Deno as Javascript runtimes. Bun is not yet supported due to an upstream crash bug.
Status
- All Commonmark spec tests are passing.
- See TODO.md for details on extended syntax support.
Example
gleam add mork@1
import simplifile
import mork
pub fn main() -> Nil {
let readme = "./README.md"
let assert Ok(markdown) = simplifile.read(from: readme)
let html = markdown |> mork.parse |> mork.to_html
let assert Ok(_) = html |> simplifile.write(to: "README.html")
}
Further documentation can be found at https://hexdocs.pm/mork.
Development
gleam build # Build the project
gleam test # Run the tests
gleam test tabs # Run only the Tabs section of tests
gleam test tabs 9 # Run only example number 9 from the test section
gleam test custom # Run only extra tests (not from the spec)
Requirements (Erlang)
- Gleam 1.13+
- Erlang 28+ (due to PCRE2 usage)
Requirements (Javascript)
- Gleam 1.13+
