Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WasmTex

An embeddable, browser-based LaTeX editor with real-time PDF preview — Monaco editor, an in-browser pdfLaTeX engine (WASM), and PDF.js. Documents that need XeLaTeX or LuaLaTeX (fontspec, unicode-math, CJK, \directlua) are auto-detected; the full multi-engine pipeline runs through the headless compiler on the client or a Node server. TeX Live packages stream from a public CDN, so there's nothing to host.

Live Demo

Quick Start

WasmTex is not on npm — install from GitHub. The install ships a prebuilt lib/ bundle, so it works with no build step. monaco-editor and pdfjs-dist are peer dependencies.

npm install monaco-editor pdfjs-dist
npm install github:corca-ai/wasmtex#main
import * as pdfjsLib from 'pdfjs-dist'
import { WasmTex } from 'wasmtex'
import 'wasmtex/style.css'

// Worker setup is REQUIRED — see the Integration Guide for the full block.
self.MonacoEnvironment = { /* monaco workers */ }
pdfjsLib.GlobalWorkerOptions.workerSrc = new URL(
  'pdfjs-dist/build/pdf.worker.mjs', import.meta.url,
).toString()

const editor = new WasmTex('#editor', '#preview', {
  files: { 'main.tex': '\\documentclass{article}\\begin{document}Hi!\\end{document}' },
})
await editor.init()

👉 Start here: the Integration Guide has the complete worker setup and copy-pasteable recipes. A minimal example lives in examples/embed.html.

Packages / Entry Points

Import Purpose
wasmtex Full editor + PDF preview SDK.
wasmtex/headless DOM-free compiler (your app owns editor/preview).
wasmtex/node Run the engines under Node (installNodeWorkerHost + WasmTexCompiler).
wasmtex/lsp Monaco-free LaTeX language service core.
wasmtex/lsp/monaco Monaco provider adapter.
wasmtex/lsp/server Transport-agnostic JSON-RPC language server.
wasmtex/synctex SyncTeX parser + PDF↔source mapping, for a custom viewer.
wasmtex/style.css Optional built-in UI/viewer styles.

Documentation

Contributing to WasmTex itself? Start with CONTRIBUTING.md (setup, standards, PR process), then AGENTS.md and docs/develop.md.

Language features

The built-in LaTeX language server (editor-neutral cores in src/lsp/, with a Monaco adapter) provides:

Feature Status
Completion (commands, refs, cites, packages, files)
Hover (commands w/ signature + package, citations)
Go-to-definition / references / rename
Document symbols / outline
Diagnostics + ChkTeX-style linter
Signature help (argument hints)
Folding ranges (environments, sections, % region)
Document highlight (occurrences under cursor)
Workspace symbols (labels/sections/commands) ✅ via wasmtex/lsp service + LSP server (Monaco has no workspace-symbol UI)
Code actions (insert ~, add \usepackage, create \label)
Inlay hints (resolved .aux numbers next to \ref)
Document links (\input/\include, \url/\href)
Semantic tokens (commands, math, comments, verbatim)
Formatting (latexindent-style) ⏳ planned

Contributing

Contributions are welcome! Please read CONTRIBUTING.md for setup, coding standards, and the PR process, and note the committed-lib/ rebuild rule.

  • 🐛 Bugs / features: open an issue.
  • 🔐 Security: report privately — see SECURITY.md.
  • 🤝 Conduct: participation is governed by our Code of Conduct.
  • 📓 Changes: notable changes are tracked in the Changelog.

License

Original WasmTex code and documentation are licensed under the MIT License. Third-party engines, generated WASM, TeX Live packages and fonts, ICU data, and peer dependencies retain their own licenses; see Third-Party Notices and the included license texts. The MIT SDK may be used in a closed-source product when the separately distributed engine assets satisfy their own terms; see the proprietary integration guide.

About

WASM TeX engines (pdfLaTeX/XeLaTeX/LuaLaTeX)

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages