All Projects → runarberg → mathup

runarberg / mathup

Licence: MIT license
Easy MathML authoring tool with a quick to write syntax

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to mathup

react-mathjax-preview
The MathJax React component you were looking for.
Stars: ✭ 46 (+0%)
Mutual labels:  mathml, asciimath
mathconverter
Converts from AsciiMath, LaTeX, MathML to LaTeX, MathML
Stars: ✭ 35 (-23.91%)
Mutual labels:  mathml, asciimath
react-native-math-view
Math view for react native! No WebView!
Stars: ✭ 49 (+6.52%)
Mutual labels:  mathml, mathematical-expressions
hext
Markup language and tool for generating binary files
Stars: ✭ 23 (-50%)
Mutual labels:  markup-language
mathtype-extension
Calabash extension step to convert MathType OLE objects to MathML
Stars: ✭ 15 (-67.39%)
Mutual labels:  mathml
doconce
Lightweight markup language - Document Once
Stars: ✭ 43 (-6.52%)
Mutual labels:  markup-language
markright
A customizable markdown parser in Elixir: pure pattern matching.
Stars: ✭ 14 (-69.57%)
Mutual labels:  markup-language
Asciidocfx
Asciidoc Editor and Toolchain written with JavaFX 16 (Build PDF, Epub, Mobi and HTML books, documents and slides)
Stars: ✭ 1,533 (+3232.61%)
Mutual labels:  mathml
abstractmark
Next level generation of markdown, allowing users to add styling, classes, and more into their markdown.
Stars: ✭ 19 (-58.7%)
Mutual labels:  markup-language
TextGraphic
TextGraphic is a framework for creating Textual Graphics. It provides layers, styling, rich color, text justification, layouts, tables, view-ports, transparency, etc.
Stars: ✭ 83 (+80.43%)
Mutual labels:  asciimath
LaTeX-Templates
Document templates composed using LaTeX for my college assignments and projects (Applicable for any other university or college) ✨
Stars: ✭ 18 (-60.87%)
Mutual labels:  mathematical-expressions
flatorize
Generate fast implementations of mathematical expressions. Inclues a linear algebra library.
Stars: ✭ 18 (-60.87%)
Mutual labels:  mathematical-expressions
showdown-katex
Math typesetting for showdown
Stars: ✭ 32 (-30.43%)
Mutual labels:  asciimath
CDom
Simple HTML/XML/BBCode DOM component for PHP.
Stars: ✭ 26 (-43.48%)
Mutual labels:  markup-language
Linq.Expression.Optimizer
System.Linq.Expression expressions optimizer. http://thorium.github.io/Linq.Expression.Optimizer
Stars: ✭ 81 (+76.09%)
Mutual labels:  mathematical-expressions
nim-mathexpr
Tiny math expression evaluator library implemented in pure Nim
Stars: ✭ 58 (+26.09%)
Mutual labels:  mathematical-expressions
MathJax-dev
Build and release tools for the MathJax project
Stars: ✭ 34 (-26.09%)
Mutual labels:  mathml
d-mark
Semantic markup language
Stars: ✭ 13 (-71.74%)
Mutual labels:  markup-language
Calculate
Math Expressions Parser Engine
Stars: ✭ 30 (-34.78%)
Mutual labels:  mathematical-expressions
texmlbus
Texmlbus (Tex to XML BUild System) supports the conversion process of documents written in LaTeX to pdf, html, xhtml or jats.
Stars: ✭ 16 (-65.22%)
Mutual labels:  mathml

mathup

npm License Build Status Coverage Status Downloads
dependencies dev-dependencies npms Score

Installation

npm
npm install mathup
import mathup from "mathup";
Client

Download one of the released assets and include the module:

<script type="module" src="mathup.mjs"></script>

…the custom element:

<script type="module" src="math-up-element.mjs"></script>

…or the script:

<script src="mathup.iife.mjs"></script>

Usage

const expression = "1+1 = 2";
const options = {};  // optional
const mathml = mathup(expression, options);

mathml.toString();
// => "<math><mrow><mn>1</mn><mo>+</mo><mn>1</mn></mrow><mo>=</mo><mn>2</mn></math>"

const mathNode = mathml.toDOM();
// => [object MathMLElement]

// Update existing <math> node in place
mathup("3-2 = 1", { bare: true }).updateDOM(mathNode);
Custom Element
<math-up
  display="inline"
  dir="ltr"
  decimal-mark=","
  col-sep=";"
  row-sep=";;"
>
  1+1 = 2
</math-up>
Command Line
npm install -g mathup

mathup [options] -- <expression>

# or from stdin
echo <expression> | mathup [options]

Options (with defaults)

const options = {
  decimalMark: ".",   // -m,  --decimalmark="."
  colSep: ",",        // -c,  --colsep=","
  rowSep: ";",        // -r,  --rowsep=";"
  display: "inline",  // -d,  --display
  dir: "ltr",         //      --rtl
  bare: false,        // -b,  --bare
}

Reference

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:

npm test

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:

./bin/mathup.mjs -- 'my expression'

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

npm run server
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].