Cmarkit v0.3.0

Cmarkit parses the CommonMark specification. It provides:

See the quick start.

Library cmarkit

Quick start

The following functions render CommonMark snippets using the built-in renderers. The parsing bit via Cmarkit.Doc.of_string is always the same except for CommonMark rendering where we make sure to keep the layout for source layout preservation.

If strict is true the CommonMark specification is strictly followed otherwise the built-in extensions are enabled.

let cmark_to_html : strict:bool -> safe:bool -> string -> string =
fun ~strict ~safe md ->
  let doc = Cmarkit.Doc.of_string ~strict md in
  Cmarkit_html.of_doc ~safe doc

let cmark_to_latex : strict:bool -> string -> string =
fun ~strict md ->
  let doc = Cmarkit.Doc.of_string ~strict md in
  Cmarkit_latex.of_doc doc

let cmark_to_commonmark : strict:bool -> string -> string =
fun ~strict md ->
  let doc = Cmarkit.Doc.of_string ~layout:true ~strict md in
  Cmarkit_commonmark.of_doc doc

If you want to: