Expand description
§LiteDoc Core
A deterministic, AI-token-efficient document format parser.
LiteDoc provides an alternative to Markdown with explicit fenced block syntax, making it ideal for AI consumption due to reduced ambiguity and lower token counts.
§Quick Start
use litedoc_core::{Parser, Profile};
let input = "# Hello World\n\nThis is a **paragraph**.";
let mut parser = Parser::new(Profile::Litedoc);
let doc = parser.parse(input).unwrap();
println!("Parsed {} blocks", doc.blocks.len());§Error Recovery
The parser supports graceful error recovery:
use litedoc_core::{Parser, Profile};
let input = "::unknown\nsome content\n::";
let mut parser = Parser::new(Profile::Litedoc);
let result = parser.parse_with_recovery(input);
// Document is still parsed, errors are collected
println!("Blocks: {}, Errors: {}", result.document.blocks.len(), result.errors.len());§Profiles
Profile::Litedoc- Full native syntax with explicit fencingProfile::Md- CommonMark + GFM subsetProfile::MdStrict- CommonMark core only
Re-exports§
pub use ast::Block;pub use ast::Document;pub use ast::Inline;pub use ast::Profile;pub use error::ParseError;pub use error::ParseErrorKind;pub use error::ParseErrors;pub use parser::ParseResult;pub use parser::Parser;