block

Intermediate representation for parsed markdown.

The parse pass produces a Vec<Block> which the render pass walks to produce styled terminal output. Splitting parsing from rendering keeps each step small and independently testable.

enum Block

source

pub enum Block

A top-level markdown block.

Variant Description
BlockQuote { blocks: Vec<Block>, kind: Option<BlockQuoteKind> } A blockquote, optionally tagged as a GitHub-flavored alert.
CodeBlock { content: String, lang: Option<String> } A fenced or indented code block rendered verbatim.
Heading { inlines: Vec<Inline>, level: HeadingLevel } A heading with its level and inline contents.
List { items: Vec<Vec<Block>>, ordered: bool } An ordered or unordered list.
Paragraph(Vec<Inline>) A paragraph containing inline elements.
Rule A horizontal rule (thematic break).

Implements Clone, Debug, Eq, PartialEq.

enum Inline

source

pub enum Inline

An inline element inside a block.

Variant Description
Code(String) Inline code span.
Emphasis(Vec<Inline>) Italicized children.
Link { text: Vec<Inline>, url: String } A hyperlink with styled link text.
Strong(Vec<Inline>) Bold children.
Text(String) Plain text with no inline styling.

Implements Clone, Debug, Eq, PartialEq.