Markdown2
Documentation for the private Markdown2
module.
Index
Documenter.Utilities.Markdown2
Documenter.Utilities.Markdown2.List
Documenter.Utilities.Markdown2.MD
Documenter.Utilities.Markdown2.MarkdownBlockNode
Documenter.Utilities.Markdown2.MarkdownInlineNode
Documenter.Utilities.Markdown2.MarkdownNode
Documenter.Utilities.Markdown2.Paragraph
Documenter.Utilities.Markdown2.ThematicBreak
Base.convert
Documenter.Utilities.Markdown2.walk
Docstrings
Documenter.Utilities.Markdown2
— Module.Provides types and functions to work with Markdown syntax trees.
The module is similar to the Markdown standard library, but aims to be stricter and provide a more well-defined API.
Markdown2 does not provide a parser, just a data structure to represent Markdown ASTs.
Markdown nodes
The types in this module represent the different types of nodes you can have in a Markdown abstract syntax tree (AST). Currently it supports all the nodes necessary to represent Julia flavored Markdown. But having this as a separate module from the Markdown standard library allows us to consistently extend the node type we support (e.g. to support the raw HTML nodes from CommonMark, or strikethrough text from GitHub Flavored Markdown).
Markdown nodes split into to two different classes: block nodes and inline nodes. Generally, the direct children of a particular node can only be either inline or block (e.g. paragraphs contain inline nodes, admonitions contain block nodes as direct children).
In Markdown2, this is represented using a simple type hierarchy. All Markdown nodes are subtypes of either the MarkdownBlockNode
or the MarkdownInlineNode
abstract type. Both of these abstract types themselves are a subtype of the MarkdownNode
.
Additional methods
- The
Base.convert(::Type{Markdown2.MD}, md::Markdown.MD)
method can be used to convert the Julia Markdown standard libraries ASTs into Markdown2 ASTs. - The
walk
function can be used for walking over aMarkdown2.MD
tree.
struct List <: MarkdownBlockNode
If .orderedstart
is nothing
then the list is unordered. Otherwise is specifies the first number in the list.
struct MD
The root node of a Markdown document. Its children are a list of top-level block-type nodes. Note that MD
is not a subtype of MarkdownNode
.
abstract type MarkdownBlockNode <: MarkdownNode
Supertype for all block-level Markdown nodes.
abstract type MarkdownInlineNode <: MarkdownNode
Supertype for all inline Markdown nodes.
abstract type MarkdownNode
Supertype for all Markdown nodes.
struct Paragraph <: MarkdownBlockNode
Represents a paragraph block-type node. Its children are inline nodes.
struct ThematicBreak <: MarkdownBlockNode
A block node represeting a thematic break (a <hr>
tag).
Base.convert
— Method.convert(::Type{MD}, md::Markdown.MD) -> Markdown2.MD
Converts a Markdown standard library AST into a Markdown2 AST.
Documenter.Utilities.Markdown2.walk
— Function.walk(f, element)
Calls f(element)
on element
and any of its child elements. The elements are assumed to be Markdown2
elements.