Registry / serialization / temml
library0.13.2jsnpmunverified

A lightweight LaTeX-to-MathML Core conversion library for JavaScript, currently at v0.13.2. Released under MIT license, it offers a smaller bundle size (171KB minified) compared to MathJax (338KB) and KaTeX (280KB), with better LaTeX coverage than TeXZilla. It supports system fonts for minimal footprint and includes a comprehensive test suite. Essential for accessibility and SEO-friendly math rendering in modern browsers. Active development with periodic releases aimed at fixing bugs and adding LaTeX functions.

npm install temml
INSTALL
IMPORT
SIG · TEMML
T
temml
serializationjavascriptv0.13.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

temml
import temml from 'temml'
import { temml } from 'temml'
Default export is the main function; named export does not exist.
renderMathInElement
import { renderMathInElement } from 'temml'
const renderMathInElement = require('temml').renderMathInElement
Named export for auto-rendering within DOM elements. Use with bundlers or ESM environments.
TemmlOptions
import type { TemmlOptions } from 'temml'
Type import for TypeScript users to define option interfaces.

Demonstrates converting LaTeX to MathML string using temml() and auto-rendering math in the document body with renderMathInElement().

import temml, { renderMathInElement } from 'temml'; // Generate MathML string const mathml = temml('E = mc^2', { displayMode: true, throwOnError: false }); console.log(mathml); // Auto-render all math in a DOM element document.addEventListener('DOMContentLoaded', () => { renderMathInElement(document.body, { delimiters: [ {left: '$$', right: '$$', display: true}, {left: '$', right: '$', display: false} ], throwOnError: false }); });
Debug
Known issues
breakingRendering option `wrap` default changed from `'text'` to `'none'` in v0.12.0, breaking rendering behavior for inline math without explicit wrap option.
fix
Set `wrap: 'text'` explicitly in options to preserve old behavior, or update styles to handle MathML core wrappers.
affects: >=0.12.0
breakingRemoved support for `\url` and `\href` commands in v0.11.07: these LaTeX commands no longer produce hyperlinks.
fix
Replace `\url{...}` and `\href{url}{text}` with manual HTML anchor elements outside math mode.
affects: >=0.11.07
gotchaTemml requires Node.js >=18.13.0 for server-side usage; older Node versions cause runtime errors or missing features.
fix
Upgrade Node.js to version 18.13.0 or later, or use a polyfill/compatibility shim.
affects: >=0.11.0
gotchaChromium renders system fonts incorrectly for some MathML constructs; Latin Modern font (380KB) is recommended for best visual quality.
fix
Include the Latin Modern Math font via CSS or use a font loading strategy to ensure correct rendering in Chromium-based browsers.
affects: >=0.9.0
deprecatedTemml's `renderMathInElement` function may be deprecated in future in favor of a more streamlined API; current behavior is stable.
fix
Monitor changelog for upcoming API changes; consider using the core `temml()` function with custom DOM manipulation instead.
affects: >=0.11.0
Errors
Common errors & fixes
TypeError: temml is not a function
Importing the default export as a named export, e.g., `import { temml } from 'temml'`.
fix
Use default import: `import temml from 'temml'`.
Error: Unsupported function: \url
Using LaTeX commands removed in v0.11.07.
fix
Replace `\url{...}` with an HTML anchor element outside math mode.
Module not found: Error: Can't resolve 'temml'
Missing temml package in node_modules or incorrect import path.
fix
Run `npm install temml` and ensure import path is correct (e.g., `import temml from 'temml'`).
TypeError: Cannot read properties of undefined (reading 'firstChild')
Calling `renderMathInElement` on a DOM element that is not yet mounted or is null.
fix
Ensure the target element exists in the DOM before calling `renderMathInElement`, e.g., inside `DOMContentLoaded` event.
Upgrade
Version history
0.13.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
temml — npm install temml · libregistry