Skip to main content

mdwright_latex/
lib.rs

1//! Math-body language support for mdwright.
2//!
3//! `mdwright-latex` owns the volatile language machinery for both
4//! TeX-like math bodies and parser-backed Unicode mathematical source:
5//! lexing, parsing, command vocabulary, Unicode terminal layout, and
6//! source translation. Markdown delimiter recognition stays in
7//! `mdwright-math`; command-line delivery stays in `mdwright`.
8//!
9//! The public surface is intentionally narrow. Parser, registry, layout,
10//! and translation complexity stays behind result and diagnostic types
11//! rather than exposing lexer tokens or AST nodes.
12
13#![forbid(unsafe_code)]
14
15mod error;
16mod inspect;
17mod layout;
18#[allow(dead_code, reason = "the private TeX lexer has fixture-tested token APIs")]
19mod lexer;
20#[allow(dead_code, reason = "the private TeX parser has fixture-tested AST helpers")]
21mod parser;
22mod registry;
23mod translation;
24#[allow(dead_code, reason = "the private Unicode lexer has fixture-tested token APIs")]
25mod unicode_lexer;
26#[allow(dead_code, reason = "the private Unicode parser has fixture-tested AST helpers")]
27mod unicode_parser;
28
29pub use error::{LatexError, LatexErrorKind, SourceSpan};
30pub use inspect::{CommandEvent, inspect_math_body};
31pub use layout::{RenderedLatex, render_unicode_math};
32pub use registry::{
33    ArgumentShape, CommandCategory, CommandInfo, SupportStatus, is_known_unsupported_command, latex_symbol,
34    lookup_command, unicode_sub, unicode_sub_latex, unicode_sub_str, unicode_super, unicode_super_latex,
35    unicode_super_str, unicode_symbol_latex,
36};
37pub use translation::{
38    Translation, TranslationLoss, TranslationStatus, translate_latex_ranges_to_unicode, translate_latex_to_unicode,
39    translate_unicode_ranges_to_latex, translate_unicode_to_latex,
40};