panache_parser/lib.rs
1//! `panache-parser` is a lossless Concrete Syntax Tree (CST) parser for Pandoc
2//! Markdown, Quarto, and R Markdown documents.
3//!
4//! It preserves source structure and trivia (including markers and whitespace),
5//! making it suitable for editor tooling and formatting pipelines that require
6//! deterministic round-tripping.
7//!
8//! # Quick start
9//!
10//! ```rust
11//! use panache_parser::parse;
12//!
13//! let tree = parse("# Heading\n\nParagraph text.", None);
14//! println!("{:#?}", tree);
15//! ```
16//!
17//! # Main entry points
18//!
19//! - [`parse`]: Parse input text into a [`SyntaxNode`].
20//! - [`to_pandoc_ast`]: Project a [`SyntaxNode`] into pandoc-native AST text.
21//! - [`ParserOptions`]: Parser configuration and extension toggles.
22//! - [`syntax`]: Typed syntax wrappers and syntax kinds.
23//! - [`parser`]: Lower-level parser modules and incremental helpers.
24//!
25pub mod grid_layout;
26mod options;
27pub mod pandoc_ast;
28pub mod parser;
29pub mod range_utils;
30pub mod syntax;
31
32/// Re-export of the [`entities`] crate (HTML5 named-entity table). Downstream
33/// crates should consume the table through this re-export so the parser remains
34/// the single source of truth for HTML entity data.
35pub use entities;
36
37pub use grid_layout::{GridCellRect, GridLayout, analyze_grid};
38pub use options::Dialect;
39pub use options::Extensions;
40pub use options::Flavor;
41pub use options::PandocCompat;
42pub use options::ParserOptions;
43pub use pandoc_ast::{to_pandoc_ast, to_pandoc_json};
44pub use parser::inlines::refdef_map::{RefdefMap, collect_refdef_labels};
45pub use parser::parse;
46pub use parser::parse_with_refdefs;
47pub use syntax::SyntaxNode;