@arnavg12/green-leaf
v1.0.1
Published
A robust, offline-first LaTeX compilation SDK inspired by Overleaf's CLSI service.
Downloads
30
Maintainers
Readme
Green Leaf SDK (@arnavg12/green-leaf)
A robust, developer-friendly LaTeX compilation SDK inspired by the architecture of Overleaf's Common LaTeX Service Interface (CLSI).
This SDK abstracts the complexities of project synchronization, latexmk orchestration, and SyncTeX navigation, providing a seamless "action-oriented" interface for building LaTeX documents.
✨ Features
- 🚀 Triple-Engine Support:
- Native: Uses local
latexmkif available. - Docker: Portable compilation via Docker (zero local install).
- Remote: Seamless fallback to any CLSI-compatible API.
- Native: Uses local
- 🔄 Smart Synchronization: Incremental file tracking using stable sync states.
- 📍 Bidirectional SyncTeX: Map coordinates between PDF and source files.
- 📦 Lightweight: Zero runtime dependencies (uses Node.js built-ins).
🚀 Installation
npm install @arnavg12/green-leaf🛠️ Quick Start
import { LatexProject } from '@arnavg12/green-leaf';
const project = new LatexProject({
rootPath: './project',
mainFile: 'main.tex',
remoteEndpoint: 'https://clsi.your-domain.com' // Optional fallback
});
// Compile (Native -> Docker -> Remote)
const result = await project.compile({
compiler: 'pdflatex'
});
if (result.status === 'success') {
console.log('PDF generated at:', result.pdfUrl);
}📍 SyncTeX Navigation
// From Code line to PDF coordinates
const pdfCoords = await project.syncToPdf('main.tex', 42);
// From PDF coordinates back to source line
const sourceLoc = await project.syncToSource(1, 100, 250);📜 License
MIT © Overleaf Contributors
