Skip to main content

NodeKind

Enum NodeKind 

Source
pub enum NodeKind {
Show 42 variants Heading { level: u8, text: String, id: Option<String>, }, Paragraph, CodeBlock { language: Option<String>, code: String, }, ThematicBreak, List { ordered: bool, start: Option<u32>, tight: bool, }, ListItem, DefinitionList, DefinitionTerm, DefinitionDescription, TaskCheckbox { checked: bool, }, Blockquote, Admonition { kind: AdmonitionKind, title: Option<String>, icon: Option<String>, style: AdmonitionStyle, }, TabGroup, TabItem { title: String, }, SliderDeck { timer_seconds: Option<u32>, }, Slide { vertical: bool, }, Table { alignments: Vec<TableAlignment>, }, TableRow { header: bool, }, TableCell { header: bool, alignment: TableAlignment, }, HtmlBlock { html: String, }, FootnoteDefinition { label: String, }, Text(String), TaskCheckboxInline { checked: bool, }, Emphasis, Strong, StrongEmphasis, Strikethrough, Mark, Superscript, Subscript, Link { url: String, title: Option<String>, }, LinkReference { label: String, suffix: String, }, FootnoteReference { label: String, }, Image { url: String, alt: String, }, CodeSpan(String), InlineHtml(String), HardBreak, SoftBreak, PlatformMention { username: String, platform: String, display: Option<String>, }, InlineMath { content: String, }, DisplayMath { content: String, }, MermaidDiagram { content: String, },
}
Expand description

All supported block and inline AST node kinds.

Variants§

§

Heading

ATX or setext heading node.

Fields

§level: u8

Heading level, typically in range 1..=6.

§text: String

Plain heading text content.

§id: Option<String>

Explicit heading id, e.g. ### Title {#custom-id}.

When present, the renderer should emit it as id="..." on the heading element.

§

Paragraph

Paragraph container.

§

CodeBlock

Fenced or indented code block.

Fields

§language: Option<String>

Optional language/info string.

§code: String

Raw code block contents.

§

ThematicBreak

Horizontal rule (---, ***, ___).

§

List

Ordered or unordered list container.

Fields

§ordered: bool

Whether this is an ordered list.

§start: Option<u32>

Starting number for ordered lists.

§tight: bool

Whether list items are tight (no blank separators).

§

ListItem

List item container.

§

DefinitionList

Extended definition lists (Markdown Guide / Markdown Extra-style).

Rendering convention:

  • A DefinitionList contains alternating DefinitionTerm (<dt>) and DefinitionDescription (<dd>) children.
  • DefinitionTerm should contain inline children.
  • DefinitionDescription should contain block children.
§

DefinitionTerm

Definition term (dt) item.

§

DefinitionDescription

Definition description (dd) item.

§

TaskCheckbox

GFM task list checkbox marker for a list item.

This is emitted by the list parser when a list item begins with [ ] or [x] / [X].

Rendering convention:

  • This node is expected to appear as the first child inside a ListItem.
  • The HTML renderer will convert it into a themed checkbox icon.

Fields

§checked: bool

Whether checkbox is checked.

§

Blockquote

Blockquote container.

§

Admonition

GitHub-style admonition / alert (GFM extension).

This is created by a post-parse transformation that recognizes a special first line inside a blockquote (e.g. [!NOTE]) and removes that marker.

Fields

§kind: AdmonitionKind

Admonition semantic kind.

§title: Option<String>

Optional custom title for the admonition header.

Used by extended GFM-style admonitions (e.g. > [😂 Happy Header]).

§icon: Option<String>

Optional custom icon content (typically a Unicode emoji) for the title.

Rendered as text (not SVG) and must be styled by CSS.

§style: AdmonitionStyle

Render variant.

§

TabGroup

Extended tab blocks.

Syntax (container + items):

:::tab
@tab Title
Content...
:::

Children convention:

  • A TabGroup contains one or more TabItem children.
  • Each TabItem contains block children representing the tab panel content.
§

TabItem

A single tab item inside a tab group.

Fields

§title: String

User-visible tab title.

§

SliderDeck

Extended slide decks (Reveal.js-like syntax, rendered as a simple slideshow).

Syntax:

@slidestart
slide 1
---
slide 2
@slideend

Optional timer (seconds per slide): @slidestart:t5.

Children convention:

  • A SliderDeck contains one or more Slide children.
  • Each Slide contains block children representing the slide content.

Fields

§timer_seconds: Option<u32>

Optional per-slide timer value in seconds.

§

Slide

A single slide inside a slider deck.

Fields

§vertical: bool

True if this slide started after a vertical separator (--).

The current viewer treats slides as a single linear sequence (left/right). This flag is preserved for future vertical navigation.

§

Table

GFM table (pipe table extension).

Children convention:

  • Each child is a TableRow.
  • Each TableRow contains TableCell children.

Fields

§alignments: Vec<TableAlignment>

Per-column alignments.

§

TableRow

A single table row.

Fields

§header: bool

Whether this row is part of the table header.

§

TableCell

A single table cell.

Fields

§header: bool

Whether this cell is in a header row.

§alignment: TableAlignment

Effective alignment for this cell.

§

HtmlBlock

Raw block-level HTML fragment.

Fields

§html: String

Raw HTML source.

§

FootnoteDefinition

GFM-style footnote definition (extension).

Syntax:

  • [^label]: definition text
  • Continuation lines may be indented.

Rendering convention:

  • This node should not be rendered in place.
  • Instead, the renderer collects referenced footnotes and emits a footnotes section at the end of the document.

Fields

§label: String

Footnote label (without [^/]).

§

Text(String)

Plain text inline content.

§

TaskCheckboxInline

Inline task checkbox marker (extension).

This is emitted when a paragraph begins with a task marker like [ ] / [x] / [X] .

Rendering convention:

  • The HTML renderer converts it into the same themed SVG checkbox icon used for task list items.

Fields

§checked: bool

Whether checkbox is checked.

§

Emphasis

Emphasis inline container.

§

Strong

Strong emphasis inline container.

§

StrongEmphasis

Combined strong+emphasis, e.g. ***text*** or ___text___.

This is parsed as a single inline node to avoid leaving dangling delimiters that would otherwise be treated as plain text.

§

Strikethrough

Strikethrough (extension), e.g. ~~text~~.

§

Mark

Highlight/mark (extension), e.g. ==text==.

§

Superscript

Superscript (extension), e.g. ^text^.

§

Subscript

Subscript (extension), e.g. ~text~.

Inline link node.

Fields

§url: String

Link destination URL.

§title: Option<String>

Optional link title.

§

LinkReference

Reference-style link placeholder (CommonMark): [text][label], [label][], [label].

These cannot be fully resolved during inline parsing because reference definitions may appear later in the document. The top-level parse() performs a post-processing pass that converts this into a Link when a matching definition exists in Document.references.

If no matching definition is found, this should be rendered as literal bracketed text (preserving the already-parsed children for the first bracketed segment).

Fields

§label: String

Label used for reference resolution (will be normalized when looked up).

§suffix: String

Extra literal suffix after the first ] (e.g. "[]" or "[label]"). Empty for shortcut reference links.

§

FootnoteReference

GFM-style footnote reference (extension), e.g. [^label].

Rendering convention:

  • If a matching FootnoteDefinition exists, this renders as a numbered superscript link.
  • Otherwise it should fall back to literal text.

Fields

§label: String

Referenced footnote label.

§

Image

Inline image node.

Fields

§url: String

Image source URL.

§alt: String

Image alt text.

§

CodeSpan(String)

Inline code span.

§

InlineHtml(String)

Inline HTML fragment.

§

HardBreak

Hard line break (two spaces + newline or backslash + newline).

§

SoftBreak

Soft line break.

§

PlatformMention

Extended user mentions.

Syntax:

  • @username[platform]
  • @username[platform](Display Name)

Rendering policy:

  • The renderer may convert this to an external profile link based on a platform mapping table.

Fields

§username: String

Platform username/handle.

§platform: String

Platform key, for example github.

§display: Option<String>

Optional display label override.

§

InlineMath

Inline math (LaTeX), e.g. $E = mc^2$.

Rendering policy:

  • Rendered using KaTeX in inline mode.
  • Content is raw LaTeX source code.

Fields

§content: String

Raw inline LaTeX content.

§

DisplayMath

Display math (LaTeX), e.g. $$\int_0^\infty e^{-x^2} dx$$.

Rendering policy:

  • Rendered using KaTeX in display mode.
  • Content is raw LaTeX source code.

Fields

§content: String

Raw display LaTeX content.

§

MermaidDiagram

Mermaid diagram (code block with language=“mermaid”).

Rendering policy:

  • Rendered using mermaid-rs-renderer to SVG.
  • Content is raw Mermaid diagram source code.

This is created during parsing when a fenced code block has info string “mermaid”.

Fields

§content: String

Raw Mermaid diagram source.

Trait Implementations§

Source§

impl Clone for NodeKind

Source§

fn clone(&self) -> NodeKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NodeKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.