pub enum Node {
Show 30 variants
Section(Section),
Heading(Heading),
Paragraph(Paragraph),
List(List),
ListItem(ListItem),
BlockQuote(BlockQuote),
CodeBlock(CodeBlock),
Table(Table),
TableRow(TableRow),
TableCell(TableCell),
ThematicBreak(ThematicBreak),
Raw(Raw),
Text(Text),
Emphasis(Emphasis),
Strong(Strong),
InlineCode(InlineCode),
Link(Link),
Image(Image),
LineBreak(LineBreak),
Admonition(Admonition),
DefinitionList(DefinitionList),
DefinitionTerm(DefinitionTerm),
DefinitionDescription(DefinitionDescription),
FootnoteReference(FootnoteReference),
FootnoteDefinition(FootnoteDefinition),
Math(Math),
Figure(Figure),
Caption(Caption),
Anchor(Anchor),
Custom(Custom),
}Expand description
A node in the document tree.
Serialized with a type tag holding the Node::kind name, for core
kinds, followed by the variant’s fields.
Variants§
Section(Section)
A titled section; by convention its first child is a Heading.
Heading(Heading)
A heading.
Paragraph(Paragraph)
A paragraph.
List(List)
A bulleted or numbered list whose children are list items.
ListItem(ListItem)
An item of a List.
BlockQuote(BlockQuote)
A block quote.
CodeBlock(CodeBlock)
A block of code or preformatted text.
Table(Table)
A table whose children are table rows.
TableRow(TableRow)
A row of a Table whose children are table cells.
TableCell(TableCell)
A cell of a TableRow.
ThematicBreak(ThematicBreak)
A horizontal rule.
Raw(Raw)
Content passed through verbatim to renderers of a matching format, such as inline HTML in Markdown.
Text(Text)
Plain text.
Emphasis(Emphasis)
Emphasized (usually italic) text.
Strong(Strong)
Strongly emphasized (usually bold) text.
InlineCode(InlineCode)
Inline code.
Link(Link)
A hyperlink.
Image(Image)
An image.
LineBreak(LineBreak)
A hard line break.
Admonition(Admonition)
A callout such as a note or warning.
DefinitionList(DefinitionList)
A list of terms and their descriptions: children alternate between
Node::DefinitionTerm and one or more
Node::DefinitionDescriptions.
DefinitionTerm(DefinitionTerm)
A term in a DefinitionList.
DefinitionDescription(DefinitionDescription)
The description of the term before it in a DefinitionList.
FootnoteReference(FootnoteReference)
A reference to a footnote, e.g. [^1].
FootnoteDefinition(FootnoteDefinition)
The text of a footnote.
Math(Math)
A mathematical formula, inline or on its own line.
Figure(Figure)
Content (usually an image) with an optional Node::Caption as its
last child.
Caption(Caption)
The caption of a Figure.
Anchor(Anchor)
A link target with no content of its own, e.g. a reStructuredText label in front of a paragraph.
Custom(Custom)
A node kind defined by a plugin rather than by lsdocs.
Implementations§
Source§impl Node
impl Node
Sourcepub fn kind(&self) -> Cow<'static, str>
pub fn kind(&self) -> Cow<'static, str>
The name plugins use to select this node, e.g. in transformer
capabilities: the type tag for core kinds ("heading"), or
"custom:<kind>" for custom nodes.
Sourcepub fn span_mut(&mut self) -> &mut Option<Span>
pub fn span_mut(&mut self) -> &mut Option<Span>
Mutable access to where this node came from, e.g. to move spans found in a piece of text to where that piece is in the source.
Sourcepub fn children_mut(&mut self) -> Option<&mut Vec<Node>>
pub fn children_mut(&mut self) -> Option<&mut Vec<Node>>
Mutable access to this node’s children, or None for leaf kinds.
Sourcepub fn descendants(&self) -> Descendants<'_> ⓘ
pub fn descendants(&self) -> Descendants<'_> ⓘ
Iterates over this node and everything below it, depth first.