MDExNative.Comrak.Document (MDExNative v0.2.7)

Copy Markdown View Source

Root of a parsed Comrak Markdown document.

A document contains the block and inline nodes produced by MDExNative.Comrak.parse_document/2. Nodes containing child nodes expose them through their :nodes field, while every parsed node includes its original MDExNative.Comrak.Sourcepos.

Example

MDExNative.Comrak.parse_document("# Hello")
%MDExNative.Comrak.Document{
  nodes: [
    %MDExNative.Comrak.Heading{
      nodes: [%MDExNative.Comrak.Text{literal: "Hello"}],
      level: 1
    }
  ]
}

Documents may be built or changed using the node structs in the MDExNative.Comrak namespace, then rendered with MDExNative.Comrak.document_to_html/2, MDExNative.Comrak.document_to_commonmark/2, or MDExNative.Comrak.document_to_xml/2.

Summary

Types

t()

@type t() :: %MDExNative.Comrak.Document{
  nodes: [MDExNative.Comrak.ast_node()],
  sourcepos: MDExNative.Comrak.Sourcepos.t()
}