Enum comrak::nodes::NodeValue

source ·
pub enum NodeValue {
Show 32 variants Document, FrontMatter(String), BlockQuote, List(NodeList), Item(NodeList), DescriptionList, DescriptionItem(NodeDescriptionItem), DescriptionTerm, DescriptionDetails, CodeBlock(NodeCodeBlock), HtmlBlock(NodeHtmlBlock), Paragraph, Heading(NodeHeading), ThematicBreak, FootnoteDefinition(NodeFootnoteDefinition), Table(NodeTable), TableRow(bool), TableCell, Text(String), TaskItem(Option<char>), SoftBreak, LineBreak, Code(NodeCode), HtmlInline(String), Emph, Strong, Strikethrough, Superscript, Link(NodeLink), Image(NodeLink), FootnoteReference(NodeFootnoteReference), MultilineBlockQuote(NodeMultilineBlockQuote),
}
Expand description

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 ext_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(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

Block. A thematic break. Has no children.

§

FootnoteDefinition(NodeFootnoteDefinition)

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

§

Table(NodeTable)

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

§

TableRow(bool)

Block. A table row. The bool represents whether the row is the header row or not. Contains table cells.

§

TableCell

Block. A table cell. Contains inlines.

§

Text(String)

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

§

TaskItem(Option<char>)

Inline. 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.

§

Emph

Inline. Emphasised text.

§

Strong

Inline. Strong text.

§

Strikethrough

Inline. Strikethrough text per the GFM spec.

§

Superscript

Inline. Superscript. Enabled with ext_superscript option.

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

§

Image(NodeLink)

Inline. An image.

§

FootnoteReference(NodeFootnoteReference)

Inline. A footnote reference.

§

MultilineBlockQuote(NodeMultilineBlockQuote)

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

>>>
A paragraph.

- item one
- item two
>>>

Implementations§

source§

impl NodeValue

source

pub fn block(&self) -> bool

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

source

pub fn contains_inlines(&self) -> bool

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

source

pub fn text(&self) -> Option<&String>

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

Convenience method.

source

pub fn text_mut(&mut self) -> Option<&mut String>

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

Convenience method.

Trait Implementations§

source§

impl Clone for NodeValue

source§

fn clone(&self) -> NodeValue

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for NodeValue

source§

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

Formats the value using the given formatter. Read more
source§

impl PartialEq for NodeValue

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for NodeValue

source§

impl StructuralEq for NodeValue

source§

impl StructuralPartialEq for NodeValue

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> 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,

§

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>,

§

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>,

§

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.