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: <https://example.com>, <a@b.c>, or a GFM literal autolink, a bare https://…, www.…, or email address. The text as written is the node’s one fact; Autolink::destination derives the link target from it.
BlankLine
A blank line the source holds beyond the one that separates two blocks: K blank lines between two blocks are one separator and K − 1 of these. Before a document’s first block, at the start or end of a block quote, alert, HTML container, or container directive, and after a document’s last line, each blank line is one. Source: a line holding only whitespace and its containers’ > markers.
BlockQuote
A block quote: content prefixed with > .
CharacterReference
A character reference such as &amp; or &#247;. The reference as written is the node’s one fact; CharacterReference::value decodes it.
CodeBlock
A code block. Source: ```lang … ``` (fenced) or 4-space-indented lines.
CodeInline
An inline code span: `code`. The fence and the padding spaces are not recorded: the serializer chooses them from the value.
ContainerDirective
A container directive. Source: :::name[label]{attrs} … :::.
Definition
A link reference definition. Source: [label]: destination "title".
Delete
Strikethrough: ~~text~~.
DirectiveAttribute
One attribute of a directive’s {name=value} block.
Document
The root of a document: a sequence of top-level Blocks, and for a parsed document the source it was parsed from.
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 … ###### Title (ATX).
HtmlBlock
A raw HTML block: HTML emitted verbatim.
HtmlContainer
A structured raw HTML container, such as <details> ... </details>.
HtmlInline
Raw inline HTML such as <span> or </em>.
HtmlTag
A raw HTML tag that bounds an HtmlContainer.
Image
An inline image: ![alt](destination "title").
ImageReference
A reference image: ![alt][label], ![alt][], or ![alt].
InlineFootnote
An inline footnote: ^[inline note].
LeafDirective
A leaf directive. Source: ::name[label]{attrs}.
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$.
NodeMeta
Metadata attached to every AST node; currently just the source span.
NodePath
Child indices from a document down to one node. A list’s children are its items, a table’s are its rows, and a row’s are its cells; every other container’s are its blocks.
Paragraph
A paragraph: a run of inline content. Source: any plain text line(s).
Shortcode
An emoji shortcode: :name:, where name is a gemoji name or alias.
SoftBreak
A soft line break: a plain newline within a paragraph.
Strong
Strong emphasis (typically bold): **text** or __text__.
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.
Tag
A tag: # and a name, such as #rust or #ai/agents.
Text
Literal text content.
TextDirective
A text directive. Source: :name[label]{attrs}.
ThematicBreak
A thematic break / horizontal rule. Source: ---, ***, or ___.
Title
The title of a Link, Image, or Definition: its text and the quotes it is written in.
WikiLink
A wiki link: [[target|label]], or an embed: ![[target|label]].

Enums§

AlertKind
The kind of a GFM Alert (the [!KIND] marker).
AutolinkForm
How an Autolink is written.
Block
A block-level node: the building blocks of a document’s vertical structure.
CodeBlockKind
Whether a CodeBlock is fenced or indented.
EmphasisDelimiter
The delimiter character of an Emphasis or Strong span.
FenceMarker
The character used to fence a CodeBlock.
FrontmatterKind
The format of a Frontmatter block.
HtmlContainerContent
The parsed content inside an HtmlContainer.
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.