Skip to main content

badness_formatter/
lib.rs

1//! badness-formatter — the deterministic, rule-based formatting engine behind
2//! [badness](https://badness.dev/), for LaTeX (`.tex`, `.sty`/`.cls`, `.dtx`,
3//! `.ins`) and BibTeX (`.bib`).
4//!
5//! Layout is decided solely by the formatter's rules and the Wadler/Prettier
6//! layout engine, on the lossless CST from [`badness_parser`]. The formatter
7//! changes only trivia — it never inserts, deletes, or rewrites a non-trivia
8//! token — and `fmt(fmt(x)) == fmt(x)`.
9//!
10//! This crate is embeddable (it builds for `wasm32-unknown-unknown`); the
11//! batch path-walking check API and the CLI live in the `badness` crate.
12//!
13//! With the optional `serde` feature, [`FormatStyle`] and its enums are
14//! (de)serializable under `badness.toml`'s kebab-case spellings; the `schema`
15//! feature additionally derives `schemars::JsonSchema` for embedders that
16//! publish a config schema (see [`formatter::style`]).
17
18pub mod ast;
19pub mod bib;
20pub mod declarations;
21pub mod directives;
22pub mod formatter;
23pub mod parser;
24pub mod semantic;
25pub mod syntax;
26
27pub use formatter::{
28    FormatError, FormatStyle, ItemIndent, LineEnding, MathWrap, SentenceOptions, WrapMode, format,
29};
30
31// Re-export rowan so embedders can name the exact tree types this crate is
32// built against without pinning a matching rowan version themselves.
33pub use rowan;