Show HN: TeXbrain, a LaTeX editor that runs pdfTeX in the browser via WASM
TeXbrain is an innovative, open-source browser-based LaTeX editor that performs all compilation and Git operations client-side using WebAssembly and local file system access. It addresses common frustrations with commercial offerings by providing a privacy-first, backend-less solution, bypassing paywalls and installation hassles. This "build-your-own-tool" ethos, combined with deep technical implementation, makes it a compelling project for the Hacker News audience.
The Lowdown
TeXbrain is a novel, open-source LaTeX editor developed by a Master's engineering student to address personal frustrations with existing LaTeX tooling. Designed to run entirely within a web browser without any backend, it offers a robust, privacy-focused solution for writing, compiling, and managing LaTeX documents. The project's core innovation lies in its client-side processing, leveraging advanced web technologies to deliver a desktop-like experience.
- Client-Side Compilation: The editor compiles pdfTeX to PDF directly in the browser by using a WebAssembly port of pdfTeX (SwiftLaTeX), ensuring documents never leave the user's machine.
- Local File System Integration: For Chromium-based browsers, it employs the File System Access API to read and write directly to local project folders, allowing seamless integration with local Git setups or other editors. Firefox and Safari use a virtual filesystem fallback.
- Full Git Functionality: Built-in Git integration, powered by
isomorphic-git, allows users to clone, commit, push, and pull repositories directly from the browser without needing a command-line interface. - On-Demand Package Loading: LaTeX packages are loaded dynamically from a TeX Live mirror (jsDelivr) only when needed, then cached locally for offline use and faster subsequent compilations.
- Privacy and Security: The editor is entirely backend-less, featuring no accounts, analytics, or tracking, and all sensitive operations occur in a WebAssembly sandbox, prioritizing user data privacy.
- Rich Editing Experience: It utilizes CodeMirror 6 for the editor, providing features like syntax highlighting, autocomplete, code folding, and a live PDF preview powered by pdf.js.
- Current Limitations: TeXbrain currently supports only pdfTeX (excluding XeTeX/LuaTeX), lacks native BibTeX/Biber support (though references still show), and pins packages to the TeX Live 2020 era.
TeXbrain presents itself as a practical and secure alternative for LaTeX users who desire a portable, subscription-free, and installation-less environment, particularly beneficial for use on shared machines or for those prioritizing data sovereignty. It's a testament to what can be achieved with modern web technologies to create powerful, self-contained applications.