Skip to main content

Module ast

Module ast 

Source
Expand description

The owned Markdown AST that parse() produces and Document::to_markdown/to_html consume. Every node carries a NodeMeta with an optional source Span. Block and Inline are the two node enums; everything else is a concrete node struct or a small enum describing a node’s variant.

Structs§

Alert
A GFM alert / admonition. Source: > [!NOTE] followed by quoted content.
Autolink
An autolink: <url> or a GFM bare URL.
BlockQuote
A block quote: content prefixed with > .
CharacterReference
A character reference such as &amp; or &#247;.
CodeBlock
A code block. Source: ```lang … ``` (fenced) or 4-space-indented lines.
CodeInline
An inline code span: `code`.
ContainerDirective
A container directive. Source: :::name[label]{attrs}::: (a directive feature, not MDX).
Definition
A link reference definition. Source: [label]: destination "title".
Delete
Strikethrough: ~~text~~ (or single ~text~ when single-tilde is enabled).
DescriptionDetails
The details (: …) attached to a DescriptionItem’s term.
DescriptionItem
One entry of a DescriptionList: a term and its detail blocks. Source: a term line followed by : details lines.
DescriptionList
A description / definition list of term + details pairs.
DirectiveAttribute
One attribute of a directive’s {name=value} block.
Document
The root of a parsed document: a sequence of top-level Blocks.
Emphasis
Emphasis (typically italic): *text* or _text_.
Escape
A backslash escape such as \* or \\.
FootnoteDefinition
A footnote definition. Source: [^id]: footnote text.
FootnoteReference
A footnote reference: [^id].
Frontmatter
A leading frontmatter block. Source: --- YAML or +++ TOML at the top of the document.
Heading
A heading. Source: # Title (ATX) or Title\n=== (setext).
HtmlBlock
A raw HTML block: HTML emitted verbatim.
HtmlInline
Raw inline HTML such as <span> or </em>.
Image
An inline image: ![alt](destination "title").
ImageReference
A reference image: ![alt][label], ![alt][], or ![alt].
InlineFootnote
An inline footnote: ^[inline note].
Insert
A CriticMarkup-style insertion: ++text++.
LeafDirective
A leaf directive. Source: ::name[label]{attrs} (a directive feature, not MDX).
LineBreak
A hard line break: a trailing \ or two trailing spaces.
Link
An inline link: [text](destination "title").
LinkReference
A reference link: [text][label], [text][], or [text].
List
A bullet or ordered list. Source: - a / 1. a lines.
ListItem
A single list item, optionally a GFM task-list checkbox.
Mark
A highlight / “mark” span: ==text==.
MathBlock
A display math block. Source: $$ … $$.
MathInline
Inline math: $x$.
MdxEsm
An MDX ESM block: top-level import/export statements (distinct from directives).
MdxExpression
A block-level MDX expression: { … } (distinct from directives).
MdxExpressionInline
An inline MDX expression: { … } (distinct from directives).
MdxJsx
A block-level MDX JSX element (distinct from directives).
MdxJsxInline
An inline MDX JSX element (distinct from directives).
NodeMeta
Metadata attached to every AST node; currently just the source span.
Paragraph
A paragraph: a run of inline content. Source: any plain text line(s).
Shortcode
An emoji-style shortcode: :name:.
SoftBreak
A soft line break: a plain newline within a paragraph.
Spoiler
A spoiler span: ||text||.
Strong
Strong emphasis (typically bold): **text** or __text__.
Subscript
Subscript: ~x~.
Superscript
Superscript: ^x^.
Table
A GFM pipe table: a header row, an alignment row, then body rows. Source: | a | b | / |---|---| / | 1 | 2 |.
TableCell
A single cell of a TableRow.
TableRow
A single row of a Table.
Text
Literal text content.
TextDirective
A text directive. Source: :name[label]{attrs} (a directive feature, not MDX).
ThematicBreak
A thematic break / horizontal rule. Source: ---, ***, or ___.
Underline
Underline (underscore extension): __text__ or ___text___.
WikiLink
A wiki link: [[target|label]].

Enums§

AlertKind
The kind of a GFM Alert (the [!KIND] marker).
AutolinkKind
Whether an Autolink is angle-bracketed or a GFM bare literal.
Block
A block-level node: the building blocks of a document’s vertical structure.
CodeBlockKind
Whether a CodeBlock is fenced or indented.
DeleteMarker
Which tilde run delimited a Delete span.
FenceMarker
The character used to fence a CodeBlock.
FrontmatterKind
The format of a Frontmatter block.
HeadingKind
Which heading syntax produced a Heading.
Inline
An inline-level node: the leaf and span content inside blocks.
LineBreakKind
Which syntax produced a hard LineBreak.
LinkDestinationKind
How a link/image destination was delimited in the source.
LinkTitleKind
How a link/image title was quoted in the source.
ListDelimiter
The marker character that delimits a list’s items.
MathInlineKind
Which syntax delimited an inline MathInline span.
ReferenceKind
The form of a reference link/image.
TableAlignment
The alignment of a Table column, from the :---: delimiter row.
ThematicBreakMarker
The character used to draw a ThematicBreak.
WikiLinkLabelOrder
Whether a WikiLink’s label preceded or followed the | separator.