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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tasfer/math

v0.1.4

Published

Opt-in math node and mark for @tasfer/editor (owns the @tasfer/tex layout engine).

Readme

@tasfer/math

The opt-in math feature for @tasfer/editor: a display math block and an inline math mark, both rendered directly onto the canvas by the @tasfer/tex layout engine — no SVG, no bitmaps, no rasterization step.

The engine has no math in its base schema and nothing in it imports this package, so a host that never installs math never pulls the math stack — or the layout engine it owns — into its bundle. That dependency is exactly why math is a package and not part of the engine.

Install

npm install @tasfer/editor @tasfer/math @tasfer/tex

Usage

Compose the extension into your schema:

import { baseSchema, createEditor } from "@tasfer/editor";
import { mathExtension } from "@tasfer/math";

const schema = baseSchema.use(mathExtension());

const editor = createEditor({
  element,
  schema,
  markdown: String.raw`Euler: $e^{i\pi}+1=0$`,
});

That registers the math block and mark, their markdown codecs, the $…$ and $$…$$ input rules, the paste rule, and the selection adapters that keep a formula construct-atomic while you move through it.

Without the extension, dollar-delimited input stays literal text — the parser preserves both $…$ and $$…$$ source instead of interpreting or discarding it, so a math-free client retains content from a peer that has the feature.

The data-only entry

Workers, persistence, and other render-free contexts import @tasfer/math/data instead. It registers the codecs, markdown syntax, structured-mark behavior, and the clone adapter for the shared "math" kind — without constructing MathNode, MathMark, or the live input and canvas stack:

import { baseDataSchema } from "@tasfer/editor";
import { mathDataExtension } from "@tasfer/math/data";

export const workerDataSchema = baseDataSchema.extend(mathDataExtension());

Keep the two definitions paired but their modules separate, so a worker importing the data schema never evaluates the interactive graph.

Also exported

  • MathNode, MathMark — the node and mark classes, subclassable.
  • MATH_COMMANDS, filterMathCommands, mathCommandInsertion — a ready-made command set for a slash menu or command palette.
  • mathMatrixContext, mathMatrixResize — matrix row/column editing.
  • isValidLatex, renderToSVG — validation and an SVG export path for contexts with no canvas (previews, exports).
  • mathDocumentToStructured, structuredToMathDocument, parseMathDocumentInit — adapters between MathDocument and the editor's generic structured-content CRDT.

Formulas are stored as a structured MathDocument tree, not as an editable LaTeX string: an inline equation anchors on a single object-replacement character (U+FFFC) and its content lives wholly in the referenced document. Display and inline forms convert into each other losslessly.

Documentation

tasfer.app/docs/editor/api-schema#math

License

MIT