late2htm 0.1.0

A Rust library for converting LaTeX-formatted text into HTML with minimal styling.
Documentation
  • Coverage
  • 2.6%
    2 out of 77 items documented1 out of 5 items with examples
  • Size
  • Source code size: 43.64 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 503.05 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 20s Average build duration of successful builds.
  • all releases: 20s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • LunaStev/late2htm
    2 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • LunaStev

LaTeX to HTML

LaTeX to HTML is a Rust library that converts LaTeX-formatted text into equivalent HTML.

This crate is designed to help developers transform LaTeX documents or fragments into structured HTML. Styling is intentionally kept minimal—developers are encouraged to apply custom CSS or integrate this library into a broader styling pipeline.


✨ Features

  • ✅ Lightweight LaTeX parsing and conversion to HTML

  • ✅ Supports the following LaTeX commands:

    • Document structure: \section, \subsection, \subsubsection, \paragraph, \subparagraph
    • Text formatting: \textbf, \textit, \underline, \emph
    • Extended commands: \textcolor, \fontsize (planned)
    • Math mode: $...$, \[...\], \begin{equation} (planned)
    • Lists: itemize, enumerate, description (planned)
    • Tables: tabular (planned)
    • Figures: figure, \includegraphics (planned)
    • References and citations: \label, \ref, \cite, \footnote (planned)
    • Bibliography: thebibliography, \bibitem (planned)
    • Custom macros: \newcommand, \renewcommand (planned)
    • Fallback handler for unknown LaTeX commands: RawLatex

Note: Features marked (planned) are on the roadmap but not yet implemented.


🚀 Usage

use late2htm::convert_latex_to_html;

fn main() {
    let latex_code = r"\\section{Hello}This is \\textbf{bold}.";
    let html = convert_latex_to_html(latex_code);
    println!("{}", html);
}

Additional Test Example

use late2htm::convert_latex_to_html;

fn main() {
    let input = r"\section{Main}\subsection{Sub}\subsubsection{SubSub}\paragraph{Para}\subparagraph{SubPara}Text \textbf{bold} and \textit{italic} and \underline{under} and \emph{emph}.";
    let html = convert_latex_to_html(input);
    println!("{}", html);
}

🎖️ Crate Structure

  • parser — Parses LaTeX code into an AST (LatexNode enum).
  • htmlgen — Converts AST into HTML.
  • ast — Defines the LaTeX abstract syntax tree (LatexNode).

🎯 Project Goals

  • 🧠 Simple and intuitive API for converting LaTeX to HTML
  • 🧩 Clean and semantic HTML output, ready for custom CSS
  • 🔌 Modular architecture for easy feature extension
  • 🔍 Fallback support for unknown LaTeX commands (raw output)

📜 License

This project is licensed under the MPL-2.0 License.


🤝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to fork and submit pull requests.