litedoc_core/lib.rs
1//! # LiteDoc Core
2//!
3//! A deterministic, AI-token-efficient document format parser.
4//!
5//! LiteDoc provides an alternative to Markdown with explicit fenced block syntax,
6//! making it ideal for AI consumption due to reduced ambiguity and lower token counts.
7//!
8//! ## Quick Start
9//!
10//! ```rust
11//! use litedoc_core::{Parser, Profile};
12//!
13//! let input = "# Hello World\n\nThis is a **paragraph**.";
14//! let mut parser = Parser::new(Profile::Litedoc);
15//! let doc = parser.parse(input).unwrap();
16//!
17//! println!("Parsed {} blocks", doc.blocks.len());
18//! ```
19//!
20//! ## Error Recovery
21//!
22//! The parser supports graceful error recovery:
23//!
24//! ```rust
25//! use litedoc_core::{Parser, Profile};
26//!
27//! let input = "::unknown\nsome content\n::";
28//! let mut parser = Parser::new(Profile::Litedoc);
29//! let result = parser.parse_with_recovery(input);
30//!
31//! // Document is still parsed, errors are collected
32//! println!("Blocks: {}, Errors: {}", result.document.blocks.len(), result.errors.len());
33//! ```
34//!
35//! ## Profiles
36//!
37//! - `Profile::Litedoc` - Full native syntax with explicit fencing
38//! - `Profile::Md` - CommonMark + GFM subset
39//! - `Profile::MdStrict` - CommonMark core only
40
41pub mod ast;
42pub mod error;
43pub mod inline;
44pub mod lexer;
45pub mod parser;
46pub mod span;
47
48pub use ast::{Block, Document, Inline, Profile};
49pub use error::{ParseError, ParseErrorKind, ParseErrors};
50pub use parser::{ParseResult, Parser};