Oak Markdown Parser
High-performance incremental Markdown parser for the oak ecosystem with flexible configuration, optimized for document processing and rendering.
🎯 Overview
Oak Markdown is a robust parser for Markdown, designed to handle complete Markdown syntax including modern features. Built on the solid foundation of oak-core, it provides both high-level convenience and detailed AST generation for document processing and rendering.
✨ Features
- Complete Markdown Syntax: Supports all Markdown features including modern specifications
- Full AST Generation: Generates comprehensive Abstract Syntax Trees
- Lexer Support: Built-in tokenization with proper span information
- Error Recovery: Graceful handling of syntax errors with detailed diagnostics
🚀 Quick Start
Basic example:
use ;
📋 Parsing Examples
Document Parsing
use ;
let parser = new;
let source = new;
let result = parser.parse;
println!;
Heading Parsing
use ;
let parser = new;
let source = new;
let result = parser.parse;
println!;
🔧 Advanced Features
Token-Level Parsing
use ;
let parser = new;
let source = new;
let result = parser.parse;
println!;
Error Handling
use ;
let parser = new;
let source = new;
let result = parser.parse;
if let Some = result.result.err else
🏗️ AST Structure
The parser generates a comprehensive AST with the following main structures:
- MarkdownDocument: Root container for Markdown documents
- Heading: Heading elements with levels
- Paragraph: Text paragraphs
- List: Ordered and unordered lists
- CodeBlock: Fenced code blocks
- Inline: Emphasis, strong, links, and inline code
📊 Performance
- Streaming: Parse large Markdown files without loading entirely into memory
- Incremental: Re-parse only changed sections
- Memory Efficient: Smart AST node allocation
- Fast Recovery: Quick error recovery for better IDE integration
🔗 Integration
Oak Markdown integrates seamlessly with:
- Static Site Generators: Convert Markdown to HTML for websites
- Documentation Tools: Process and render Markdown documentation
- Content Management: Handle user-generated Markdown content
- IDE Support: Language server protocol compatibility
- Blog Platforms: Parse and render blog posts in Markdown
📚 Examples
Check out the examples directory for comprehensive examples:
- Complete Markdown document parsing
- Heading and list analysis
- Code transformation
- Integration with development workflows
🤝 Contributing
Contributions are welcome!
Please feel free to submit pull requests at the project repository or open issues.