Nervous Penpal Message

# npm

## mathup

1.0.0-beta.2 • Public • Published

# mathup

#### Installation

##### Client

…the custom element:

…or the script:

See here

## Easy MathML authoring tool with a quick to write syntax

This package exposes a single function mathup that intuitively takes simple mathematical expressions—written in a markup language inspired by AsciiMath—and outputs structured MathML.

You can use it on the command line or on the server as an npm package, or in the browser by including the script source. In the browser, you choose how to parse the math in your document—by looking hard for any math-y substrings, parsing all expressions wrapped in $$, or using some other excellent tools out there that does it for you. And you can choose what to do with the output as well—piping it to another program, inject it streight to the DOM, or just logging it to the console.

## Why not just use MathJax?

MathJax is an excellent tool that you should probably be using if all you want to do is include complex mathematical expressions in a document. And you should probably use it along side this package as well if you want Chrome users to be able to read your expressions. However, MathJax is a complex piece of software that does a great deal more than just translate simple expression into structured form, and if that is all you want to do, then MathJax is definitely overkill. Mathup promises to be a lot faster (by doing less) then MathJax, and if the readers of your document (or users of your app) are using a standard conforming browser, they will benefit a great bit. You will be able to translate your expression on the server before your readers even open the document, reducing any lag time to native.

## Why AsciiMath / Why not TeΧ?

I wrote this tool, because I wanted to be able to author mathematical expressions quickly, with no overhead (imagine 1/2 instead of \frac{1}{2}). TeΧ expressions can easily become verbose and annoying to write (especially on keyboards with complex access to the \ , {, and } keys). However, the purpose of this package is not to give people complete control over MathML in a non-verbose way, the purpose is to make it simple for people to write simple expression. Of course I’ll try to give as much expressive power as possible in the way, but I won’t promise to make all complex things possible.

If you want full support of MathML, and don’t want to write all those tags perhaps you should look for another tool. There are other great efforts to enable people to author MathML in TeX format, take a look at TeXZilla for example.

## Testing

Run the test suites with:

As for manual and visual tests, if you are running node 13 or newer, you don’t need to compile between edit and run as the code is written without transpilation in mind. The code works in both browsers and node without any transcompilation.

For a simple test do:

You can open a playground and test cases on http://localhost:8000/demo by running:

## Keywords

### Install

npm i mathup

### Repository

github.com/runarberg/mathup

### Homepage

runarberg.github.io/mathup/

9

1.0.0-beta.2

MIT

5.78 MB

93