erlmark_gleam

Package Version Hex Docs

Markdown to HTML for Gleam, powered by erlmark: a pure Erlang CommonMark 0.31.2 converter with GFM tables, strikethrough and task lists. No NIFs, and faster than the Rust-based MDEx NIF on most documents. This package runs on the Erlang target only.

Installation

gleam add erlmark_gleam

rebar3 must be installed, because Gleam builds the underlying Erlang package with it.

Usage

import erlmark_gleam as erlmark

pub fn main() {
  erlmark.to_html("# Hello *world*")
  // -> "<h1>Hello <em>world</em></h1>\n"
}

Options are built with a pipeline:

"see www.example.com"
|> erlmark.to_html_with(
  erlmark.new()
  |> erlmark.autolink
  |> erlmark.tagfilter,
)

// Convert a large document on all schedulers. The output is identical.
big_markdown
|> erlmark.to_html_with(erlmark.new() |> erlmark.parallel(erlmark.Auto))
FunctionEffect
autolinkLinks bare www., http(s):// and ftp:// URLs and e-mail addresses.
tagfilterEscapes <script>, <style> and similar tags.
parallelSequential (default), Auto or Workers(n). Splits documents of 16 KB and up.
spawn_aboveBytes(n) (default 256) or Never: when to use a helper process with a pre-sized heap.

Raw HTML in the input is passed through unchanged, as CommonMark requires. Sanitise the output if the input is untrusted.

Further documentation is at https://hexdocs.pm/erlmark_gleam.

Development

This package lives in the gleam/ directory of the erlmark repository.

gleam test
gleam format --check src test

License

Copyright 2026 Mouhieddine Sabir. Licensed under the Apache License, Version 2.0; see LICENSE.

✨ Search Document