https://github.com/lunastev/late2htm
A Rust library for converting LaTeX-formatted text into HTML with minimal styling.
https://github.com/lunastev/late2htm
arxiv arxiv-latex arxiv-latex-html html latex latex-html latextohtml library parser rust rust-library
Last synced: 2 months ago
JSON representation
A Rust library for converting LaTeX-formatted text into HTML with minimal styling.
- Host: GitHub
- URL: https://github.com/lunastev/late2htm
- Owner: LunaStev
- License: mpl-2.0
- Created: 2025-06-02T12:47:12.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-06-02T12:54:12.000Z (about 1 year ago)
- Last Synced: 2025-06-17T12:04:20.418Z (about 1 year ago)
- Topics: arxiv, arxiv-latex, arxiv-latex-html, html, latex, latex-html, latextohtml, library, parser, rust, rust-library
- Language: Rust
- Homepage: https://crates.io/crates/late2htm
- Size: 12.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# 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
```rust
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
```rust
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.