Skip to main content

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//!
25mod options;
26pub mod pandoc_ast;
27pub mod parser;
28pub mod range_utils;
29pub mod syntax;
30
31/// Re-export of the [`entities`] crate (HTML5 named-entity table). Downstream
32/// crates should consume the table through this re-export so the parser remains
33/// the single source of truth for HTML entity data.
34pub use entities;
35
36pub use options::Dialect;
37pub use options::Extensions;
38pub use options::Flavor;
39pub use options::PandocCompat;
40pub use options::ParserOptions;
41pub use pandoc_ast::{to_pandoc_ast, to_pandoc_json};
42pub use parser::inlines::refdef_map::{RefdefMap, collect_refdef_labels};
43pub use parser::parse;
44pub use parser::parse_with_refdefs;
45pub use syntax::SyntaxNode;