Enum NodeValue

#[non_exhaustive]
pub enum NodeValue

The core AST node enum.

Variants

Document

The root of every CommonMark document. Contains blocks.

FrontMatter(String)

Non-Markdown front matter. Treated as an opaque blob.

BlockQuote

Block. A block quote. Contains other blocks.

> A block quote.
List(NodeList)

Block. A list. Contains list items.

* An unordered list
* Another item

1. An ordered list
2. Another item
Item(NodeList)

Block. A list item. Contains other blocks.

DescriptionList

Block. A description list, enabled with description_lists option. Contains description items.

It is required to put a blank line between terms and details.

Term 1

: Details 1

Term 2

: Details 2
DescriptionItem(NodeDescriptionItem)

Block*. An item of a description list. Contains a term and one details block.

DescriptionTerm

Block. Term of an item in a definition list.

DescriptionDetails

Block. Details of an item in a definition list.

CodeBlock(Box<NodeCodeBlock>)

Block. A code block; may be fenced or indented. Contains raw text which is not parsed as Markdown, although is HTML escaped.

HtmlBlock(NodeHtmlBlock)

Block. A HTML block. Contains raw text which is neither parsed as Markdown nor HTML escaped.

Paragraph

Block. A paragraph. Contains inlines.

Heading(NodeHeading)

Block. A heading; may be an ATX heading or a setext heading. Contains inlines.

ThematicBreak(NodeThematicBreak)

Block. A thematic break. Has no children.

FootnoteDefinition(NodeFootnoteDefinition)

Block. A footnote definition. The String is the footnote's name. Contains other blocks.

Table(Box<NodeTable>)

Block. A table per the GFM spec. Contains table rows.

TableRow(NodeTableRow)

Block. A table row. Contains table cells.

TableCell

Block. A table cell. Contains inlines.

Text(Cow<'static, str>)

Inline. Textual content. All text in a document will be contained in a Text node.

TaskItem(NodeTaskItem)

Block. Task list item. The value is the symbol that was used in the brackets to mark a task item as checked, or None if the item is unchecked.

SoftBreak

Inline. A soft line break. If the hardbreaks option is set in Options during formatting, it will be formatted as a LineBreak.

LineBreak

Inline. A hard line break.

Code(NodeCode)

Inline. A code span.

HtmlInline(String)

Inline. Raw HTML contained inline.

Raw(String)

Block/Inline. A Raw output node. This will be inserted verbatim into CommonMark and HTML output. It can only be created programmatically, and is never parsed from input.

Emph(NodeEmph)

Inline. Emphasized text.

Strong(NodeStrong)

Inline. Strong text.

Strikethrough(NodeStrikethrough)

Inline. Strikethrough text per the GFM spec.

Highlight

*Inline. Highlight / mark text

Insert

Inline. Inserted text, rendered as <ins>.

Superscript

Inline. Superscript. Enabled with superscript option.

Inline. A link to some URL, with possible title.

Image(Box<NodeLink>)

Inline. An image.

FootnoteReference(Box<NodeFootnoteReference>)

Inline. A footnote reference.

Math(NodeMath)

Inline. A math span. Contains raw text which is not parsed as Markdown. Dollar math or code math

Inline math $1 + 2$ and $1 + 2$

Display math $$1 + 2$$ and $$ 1 + 2 $$

MathBlock(Box<NodeMathBlock>)

Block. A math block delimited by standalone $$ lines. Enabled with the math_dollars and math_dollars_block options. Contains raw text which is not parsed as Markdown, although is HTML escaped.

MultilineBlockQuote(NodeMultilineBlockQuote)

Block. A multiline block quote. Spans multiple lines and contains other blocks.

>>>
A paragraph.

- item one
- item two
>>>
Escaped

Inline. A character that has been escaped

Included in the document tree only if the escaped_char_spans parse option and/or render option is enabled.

If the render option is enabled, these are wrapped in distinct <span> tags in output HTML and XML.

Inline. A wikilink to some URL.

Underline

Inline. Underline. Enabled with underline option.

Subscript

Inline. Subscript. Enabled with subscript options.

SpoileredText

Inline. Spoilered text. Enabled with spoiler option.

EscapedTag(&'static str)

Inline. Text surrounded by escaped markup. Enabled with spoiler option. The &'static str is the tag to be escaped.

Alert(Box<NodeAlert>)

Block. GitHub style alert boxes which uses a modified blockquote syntax. Enabled with the alerts option.

Callout(Box<NodeCallout>)

Block. An Obsidian style callout. Contains other blocks. The first child may be a NodeValue::CalloutTitle container holding the custom title; all remaining children are the callout body.

CalloutTitle

Block. A container for a callout's custom title. Contains other blocks, which may include inlines themselves (e.g. a Paragraph). Never has inlines directly.

Subtext

Block. Block scoped subscript that acts similar to a header. Enabled with subtext option.

BlockDirective(Box<NodeBlockDirective>)

Block. A container directive block which can be used for custom extensions. Contains other blocks.

:::warning
A paragraph.

- item one
- item two
:::
BlockId(Box<NodeBlockId>)

Inline. An Obsidian block identifier marker (^abc123). Enabled with the ofm_block_ids option. Has no children, and is never rendered as visible text; it labels the block whose content ends with it.

CommentInline(NodeComment)

Inline. An inline comment span. Enabled with ofm_comments option.

MultilineComment(NodeCommentBlock)

Block. A block comment span. Enabled with ofm_comments option.

Implementations

impl NodeValue

fn block(&self) -> bool

Indicates whether this node is a block node or inline node.

fn contains_inlines(&self) -> bool

Whether the type the node is of can contain inline nodes.

fn text(&self) -> Option<&str>

Return a reference to the text of a Text inline, if this node is one.

Convenience method.

fn text_mut(&mut self) -> Option<&mut Cow<'static, str>>

Return a mutable reference to the text of a Text inline, if this node is one.

Convenience method.

fn xml_node_name(&self) -> &'static str

Returns the name this kind of node gets in an XML document. Follows the CommonMark DTD for nodes from the spec, otherwise we just vibe in a stable way.

Trait Implementations

impl Clone for NodeValue

fn clone(&self) -> Self

impl Debug for NodeValue

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

impl Eq for NodeValue

impl PartialEq for NodeValue

fn eq(&self, other: &Self) -> bool

impl StructuralPartialEq for NodeValue

Auto Trait Implementations

impl Freeze for NodeValue

impl RefUnwindSafe for NodeValue

impl Send for NodeValue

impl Sync for NodeValue

impl Unpin for NodeValue

impl UnsafeUnpin for NodeValue

impl UnwindSafe for NodeValue

Blanket Implementations

impl<F, T, S> SimdInto<T, S> for NodeValue where T: SimdFrom<F, S>, S: Simd,

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

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

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

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

impl<T> From<T> for NodeValue

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

impl<T, S> SimdFrom<T, S> for NodeValue where S: Simd,

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

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

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