htex is now open source! π
Transform LaTeX documents into beautiful, paginated HTML with automatic A4 page breaks based on actual content height.
β¨ Key Features
- β SDK-level pagination (works in React, Vue, Svelte, vanilla JS)
- β Pixel-perfect typography matching LaTeX output
- β KaTeX for gorgeous math rendering
- β Dark/light themes with responsive zoom
- β Automatic TikZ to SVG conversion
- β Production-ready, fully tested (456 tests passing)
π¦ Packages
- @htex/core - Main SDK (renderToHtml, htexPaginate)
- @htex/react - React component wrapper
- @htex/svelte - Svelte component wrapper
- @htex/vue - Vue component wrapper
- @htex/vanilla - Web component
π Quick Start
npm install @htex/coreReact example:
import { renderToHtml, htexPaginate } from '@htex/core'
import { useEffect, useRef } from 'react'
export function Document() {
const ref = useRef(null)
const html = renderToHtml(latexSource, { renderMode: 'paged' })
useEffect(() => {
if (ref.current) htexPaginate(ref.current)
}, [html])
return <div ref={ref} dangerouslySetInnerHTML={{ __html: html }} />
}π Documentation
- README.md - Complete guide with examples and API reference
- CONTRIBUTING.md - Development setup and contribution guidelines
- GitHub Wiki - In-depth technical documentation (coming soon)
π― Architecture Highlights
- Tokenizer - Lexical analysis of LaTeX (100+ commands supported)
- Parser - Recursive descent parser building typed AST
- Renderers - HTML, SVG, and Canvas modes
- Paginator - DOM-based height measurement with contextual margin collapse handling
π Performance
- Parse + render + paginate: ~245ms for 8-page document
- Zero external dependencies (KaTeX only)
- Runs entirely in the browser
π Known Limitations
- Advanced TikZ features (custom shapes, complex paths)
- Bibliography management
- Cross-references (\ref, \label)
- Floating figures
- Footnotes (in progress)
π License
MIT - Free to use in personal and commercial projects
π Thanks
- KaTeX for beautiful math rendering
- TypeScript for type safety
- Bun for fast builds
Ready to contribute? See CONTRIBUTING.md for development setup.
Have feedback? Open an issue or start a discussion on GitHub!