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.

Status right now is that it is entirely unusable and experimental. To see what the current state of the parser is, see the test suite.

Values

pub fn main() -> Nil

Mork is usable as a command line utility by running gleam run -m mork.

To convert a Markdown file to HTML, run gleam run -m mork example.md. By default, this writes the HTML directly to standard out.

pub fn parse(md: String) -> document.Document

Parse a string containing Markdown into a Document structure. 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 to_html(doc: document.Document) -> String

Convert a Document structure to HTML.

Search Document