Markdown parser for Gleam.
  • Gleam 99.6%
  • Shell 0.3%
  • JavaScript 0.1%
Find a file
2026-01-13 23:21:16 +01:00
data Switch humanmade logo to brainmade badge instead 2025-11-25 11:30:56 +01:00
examples/cli Move casefold to a separate package 2025-11-13 15:37:38 +01:00
gen Add emojis.get() and rename entities.resolve() to entities.get() 2025-11-16 15:02:17 +01:00
src Fix: Handle emojis containing underscore 2026-01-10 21:43:30 +01:00
test Fix: Handle emojis containing underscore 2026-01-10 21:43:30 +01:00
to_lustre 0.3.1: Fix double escaping in more cases 2026-01-13 23:21:16 +01:00
.gitignore make a bigger benchmark 2025-11-09 09:24:20 +01:00
bench.sh Update tools to gleam 1.14 and erlang 28.3 2026-01-07 15:36:39 +01:00
CHANGELOG.md 1.11.1: Fix 💜 2026-01-10 21:45:41 +01:00
DEVELOPMENT.md Added some documentation for developers and updated the TODOs 2025-11-10 23:46:02 +01:00
gleam.toml 1.11.1: Fix 💜 2026-01-10 21:45:41 +01:00
LICENSE Add experimental mork/to_lustre package 2025-12-11 21:10:58 +01:00
manifest.toml Update stdlib to 0.68.1 2026-01-10 21:43:10 +01:00
mise.toml Update tools to gleam 1.14 and erlang 28.3 2026-01-07 15:36:39 +01:00
README.md 1.11.0: Update README with to_lustre example 2025-12-11 21:15:47 +01:00
TODO.md Update readme 2025-12-09 21:03:16 +01:00

mork

Package Version Hex Docs

Brainmade

MÖRK is a Markdown parser written in pure Gleam. It is 100% spec compliant with Commonmark, supports most Github extensions, some Obsidian extensions and footnotes.

It has mainly been developed for the Erlang compilation target, but is tested against and should work for both Node.js, Deno and Bun as Javascript runtimes. Though to be fair, for someone targetting Javascript the commonmark.js library is probably faster (though it doesn't support the features of Mörk).

Status

  • All Commonmark spec tests are passing.
  • Footnotes are supported.
  • Most GFM (Github) features are supported.
  • Some Obsidian features are supported.
  • 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.

Lustre support

There is an experimental Lustre support package called mork_to_lustre:

gleam add mork_to_lustre
import mork
import mork/to_lustre

pub fn main() -> Nil {
  let markdown = "# Hello, Joe!\n"
  let e = markdown |> mork.parse |> to_lustre.to_lustre
  let e = e |> element.fragment |> element.to_string

  assert e == "<h1>Hello, Joe!</h1>"
}

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+

Data sources