commonmark

CommonMark implementation for Gleam!

This package provides a simple interface to parse CommonMark and common extensions into either an AST for further manipulation or directly to HTML.

Functions

pub fn parse(document: String) -> Document

Parse a CommonMark document into an AST.

pub fn render_to_html(document: String) -> String

Render a CommonMark document into a HTML string.

This version follows the advice in the CommonMark spec to silently resolve errors.

pub fn render_to_html_strict(
  document: String,
) -> Result(String, RenderError)

Render a CommonMark document into a HTML string.

This uses a more strict rendering that won’t attempt to fix issues in the document.

pub fn to_html(document: Document) -> String

Render an AST into a HTML string.

This version follows the advice in the CommonMark spec to silently resolve errors.

pub fn to_html_strict(
  document: Document,
) -> Result(String, RenderError)

Render an AST into a HTML string.

This uses a more strict rendered that won’t attempt to fix issues in the document.

Search Document