pub enum Block {
Paragraph(Vec<Inline>),
Heading(Heading),
ThematicBreak,
BlockQuote(Vec<Block>),
List(List),
CodeBlock(CodeBlock),
HtmlBlock(String),
Definition(LinkDefinition),
Table(Table),
FootnoteDefinition(FootnoteDefinition),
GitHubAlert(GitHubAlert),
Empty,
}Expand description
Block‑level constructs in the order they appear in the CommonMark spec.
Variants§
Paragraph(Vec<Inline>)
Ordinary paragraph
Heading(Heading)
ATX (# Heading) or Setext (===) heading
ThematicBreak
Thematic break (horizontal rule)
BlockQuote(Vec<Block>)
Block quote
List(List)
List (bullet or ordered)
CodeBlock(CodeBlock)
Fenced or indented code block
HtmlBlock(String)
Raw HTML block
Definition(LinkDefinition)
Link reference definition. Preserved for round‑tripping.
Table(Table)
Tables
FootnoteDefinition(FootnoteDefinition)
Footnote definition
GitHubAlert(GitHubAlert)
GitHub alert block (NOTE, TIP, IMPORTANT, WARNING, CAUTION)
Empty
Empty block. This is used to represent skipped blocks in the AST.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Block
impl<'de> Deserialize<'de> for Block
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl ExpandWith for Block
impl ExpandWith for Block
Source§fn expand_with<T: Transformer>(self, transformer: &mut T) -> Vec<Self>
fn expand_with<T: Transformer>(self, transformer: &mut T) -> Vec<Self>
Apply an expandable transformer to this AST node, returning multiple nodes
Source§impl Query for Block
impl Query for Block
Source§fn find_all_inlines<F>(&self, predicate: F) -> Vec<&Inline>
fn find_all_inlines<F>(&self, predicate: F) -> Vec<&Inline>
Find all inline elements matching a predicate
Source§fn find_all_blocks<F>(&self, predicate: F) -> Vec<&Block>
fn find_all_blocks<F>(&self, predicate: F) -> Vec<&Block>
Find all block elements matching a predicate
Source§fn find_first_inline<F>(&self, predicate: F) -> Option<&Inline>
fn find_first_inline<F>(&self, predicate: F) -> Option<&Inline>
Find the first inline element matching a predicate
Source§fn find_first_block<F>(&self, predicate: F) -> Option<&Block>
fn find_first_block<F>(&self, predicate: F) -> Option<&Block>
Find the first block element matching a predicate
Source§fn count_inlines<F>(&self, predicate: F) -> usize
fn count_inlines<F>(&self, predicate: F) -> usize
Count inline elements matching a predicate
Source§fn count_blocks<F>(&self, predicate: F) -> usize
fn count_blocks<F>(&self, predicate: F) -> usize
Count block elements matching a predicate
Source§fn any_inline<F>(&self, predicate: F) -> bool
fn any_inline<F>(&self, predicate: F) -> bool
Check if any inline element matches a predicate
Source§fn find_all_links(&self) -> Vec<&Link>
fn find_all_links(&self) -> Vec<&Link>
Find all links in the document
Source§fn find_all_images(&self) -> Vec<&Image>
fn find_all_images(&self) -> Vec<&Image>
Find all images in the document
Source§fn find_all_headings(&self) -> Vec<&Heading>
fn find_all_headings(&self) -> Vec<&Heading>
Find all headings in the document
Source§fn find_all_autolinks(&self) -> Vec<&str>
fn find_all_autolinks(&self) -> Vec<&str>
Find all autolinks in the document
Source§fn find_all_text(&self) -> Vec<&str>
fn find_all_text(&self) -> Vec<&str>
Find all text nodes in the document
Source§fn find_all_code_spans(&self) -> Vec<&str>
fn find_all_code_spans(&self) -> Vec<&str>
Find all code spans in the document
Source§fn find_all_code_blocks(&self) -> Vec<&CodeBlock>
fn find_all_code_blocks(&self) -> Vec<&CodeBlock>
Find all code blocks in the document
Source§fn find_all_tables(&self) -> Vec<&Table>
fn find_all_tables(&self) -> Vec<&Table>
Find all tables in the document
Source§fn find_all_lists(&self) -> Vec<&List>
fn find_all_lists(&self) -> Vec<&List>
Find all lists in the document
Source§impl TransformWith for Block
impl TransformWith for Block
Source§fn transform_with<T: Transformer>(self, transformer: &mut T) -> Self
fn transform_with<T: Transformer>(self, transformer: &mut T) -> Self
Apply a transformer to this AST node
Source§impl VisitWith for Block
impl VisitWith for Block
Source§fn visit_with<V: Visitor>(&self, visitor: &mut V)
fn visit_with<V: Visitor>(&self, visitor: &mut V)
Apply a visitor to this AST node
Source§impl<T: Default> WithData<T> for Block
impl<T: Default> WithData<T> for Block
Source§type WithDataType = Block<T>
type WithDataType = Block<T>
The type with user data attached
Source§fn with_data(self, data: T) -> Self::WithDataType
fn with_data(self, data: T) -> Self::WithDataType
Add user data to this AST node
Source§fn with_default_data(self) -> Self::WithDataTypewhere
T: Default,
fn with_default_data(self) -> Self::WithDataTypewhere
T: Default,
Add default user data to this AST node
impl StructuralPartialEq for Block
Auto Trait Implementations§
impl Freeze for Block
impl RefUnwindSafe for Block
impl Send for Block
impl Sync for Block
impl Unpin for Block
impl UnwindSafe for Block
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more