pub enum Node {
Show 23 variants
Document(Vec<Node>),
ThematicBreak,
Heading {
level: u8,
content: Vec<Node>,
heading_type: HeadingType,
},
CodeBlock {
language: Option<String>,
content: String,
block_type: CodeBlockType,
},
HtmlBlock(String),
LinkReferenceDefinition {
label: String,
destination: String,
title: Option<String>,
},
Paragraph(Vec<Node>),
BlockQuote(Vec<Node>),
OrderedList {
start: u32,
items: Vec<ListItem>,
},
UnorderedList(Vec<ListItem>),
Table {
headers: Vec<Node>,
rows: Vec<Vec<Node>>,
},
InlineCode(String),
Emphasis(Vec<Node>),
Strong(Vec<Node>),
Link {
url: String,
title: Option<String>,
content: Vec<Node>,
},
ReferenceLink {
label: String,
content: Vec<Node>,
},
Image {
url: String,
title: Option<String>,
alt: Vec<Node>,
},
Autolink {
url: String,
is_email: bool,
},
HtmlElement(HtmlElement),
HardBreak,
SoftBreak,
Text(String),
Custom(Box<dyn CustomNode>),
}Expand description
Main node type, representing an element in a CommonMark document
Variants§
Document(Vec<Node>)
Root document node, contains child nodes
ThematicBreak
Thematic break (horizontal rule)
Heading
Heading, contains level (1-6) and inline content
Fields
heading_type: HeadingTypeHeading type (ATX or Setext)
CodeBlock
Code block, containing optional language identifier and content
Fields
language: Option<String>Optional language identifier (None for indented code blocks, Some for fenced code blocks)
block_type: CodeBlockTypeThe type of code block (Indented or Fenced)
HtmlBlock(String)
HTML block
LinkReferenceDefinition
Link reference definition
Fields
Paragraph(Vec<Node>)
Paragraph node, containing inline elements
BlockQuote(Vec<Node>)
Block quote, containing any block-level elements
OrderedList
Ordered list, containing starting number and list items
UnorderedList(Vec<ListItem>)
Unordered list, containing list items
Table
Table (extension to CommonMark)
Fields
InlineCode(String)
Inline code
Emphasis(Vec<Node>)
Emphasis (italic)
Strong(Vec<Node>)
Strong emphasis (bold)
Link
Link
ReferenceLink
Reference link
Fields
Image
Image
Fields
Autolink
Autolink (URI or email wrapped in < and >)
HtmlElement(HtmlElement)
HTML inline element
HardBreak
Hard break (two spaces followed by a line break, or backslash followed by a line break)
SoftBreak
Soft break (single line break)
Text(String)
Plain text
Custom(Box<dyn CustomNode>)
Custom node that allows users to implement their own writing behavior