Skip to main content

parse_to_ast

Function parse_to_ast 

Source
pub fn parse_to_ast(markdown: &str, options: &ParseOptions) -> Block
Expand description

Parse a Markdown string and return the block-level AST.

This returns the raw AST without rendering to HTML, useful for programmatic inspection or transformation of the document structure.

ยงExamples

use ironmark::{parse_to_ast, ParseOptions, Block};

let ast = parse_to_ast("# Hello", &ParseOptions::default());
match &ast {
    Block::Document { children } => {
        assert_eq!(children.len(), 1);
    }
    _ => panic!("expected Document"),
}