npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

mathlive

v0.108.2

Published

A web component for math input

Readme

Maintenance GitHub license

MathLive ships batteries-included UI components that bring TeX-quality math to the web. Drop a mathfield on the page, wire up the events you care about, and MathLive handles rendering, editing, speech, and keyboard UX for you.

  • 800+ built-in LaTeX commands with high-fidelity typesetting
  • Mobile-ready virtual keyboards and physical keyboard shortcuts
  • Export/import as LaTeX, MathML, ASCIIMath, Typst, or MathJSON
  • Screen-reader friendly with math-to-speech and ARIA labels
  • Highly customizable UI, themes, macros, commands, and behaviors

Components at a Glance

<math-field> - The flagship math editor. Provides text-area like APIs (value, selection, executeCommand()), emits input and change events, and exposes a full virtual keyboard UI with custom layouts.

<math-span> - Inline, lightweight renderer for static math. Ideal for embedding expressions inside paragraphs without initializing a full mathfield.

<math-div> - Block-level renderer for static math and display equations. Useful for articles, assessments, or anywhere you previously called renderMathInDocument().

Both static components:

  • Accept LaTeX by default and support format="ascii-math" or format="math-json"
  • Expose a mode attribute (textstyle/displaystyle)
  • Lazy-load shared fonts once, defer rendering until visible via Intersection Observer, and auto-generate ARIA labels with speech-friendly text
  • Provide an imperative render() method when you need to update content programmatically
<math-span>e^{i\pi} + 1 = 0</math-span>
<math-div format="ascii-math">int_0^oo e^(-x^2) dx</math-div>

🚀 Quick Start

Install and import the component bundle:

npm install mathlive
import 'mathlive';

Render a mathfield:

<!DOCTYPE html>
<html lang="en-US">
  <body>
    <math-field virtual-keyboard-mode="auto" smart-fence>f(x)=x+1</math-field>
  </body>
</html>

Render static math without the editor chrome:

<math-span id="area">A = \pi r^2</math-span>
<math-div format="math-json" mode="displaystyle">
  {"kind":"Multiply","args":["x",{"kind":"Power","base":"y","exponent":2}]}
</math-div>
<script type="module">
  const formula = document.getElementById('area');
  formula.textContent = 'A = \\pi r^2';
  await formula.render();
</script>

Or load MathLive from a CDN:

<head>
  <script defer src="https://cdn.jsdelivr.net/npm/mathlive"></script>
</head>

Framework Guides

📖 Documentation

Comprehensive guides cover customization, command execution, macros, keyboard shortcuts, speech output, static rendering, and more. Browse everything on MathLive.io and dig into the Mathfield API reference for full typings and method docs.

FAQ

Q: When is the next release?

MathLive follows a semi-annual cadence with major drops around June and January, plus patch releases for regression fixes. Sponsor requests or community pull requests can trigger out-of-band releases when needed.

Related Projects

💬 Contact Us

📃 License

This project is licensed under the MIT License.