Get the latest tech news
Mathup: Easy MathML authoring tool with a quick to write syntax
Installation npm npm install mathup import mathup from "mathup"; Client Download one of the following: - Module (full, min) - Script (full, min) - Custom element as module (full, min) - Custom element as script (full, min) - Stylesheet (full; not needed for custom element) …and include the module: <script type="module" src="mathup.js"></script> <link rel="stylesheet" href="mathup.css" /> …the custom element: <script type="module" src="math-up-element.js"></script> …or the script: <script src="mathup.iife.js"></script> <link rel="stylesheet" href="mathup.css" /> 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 --decimal-mark="." colSep: ",", // -c --col-sep="," rowSep: ";", // -r --row-sep=";" display: "inline", // -d --display="inline" dir: "ltr", // --rtl bare: false, // -b --bare }; Note: If you pick , as your decimal mark then ; becomes the new default column separator. And if ; is your column separator then the new default row separator becomes ;;.
Mathup uses four of MathML’s token elements (identifiers<mi>, operators<mo>, numbers<mn> and text<mtext>). ⊙^^^ ⋀ vvv ⋁ nnn ⋂ uuu ⋃*** ⋆|><| ⋈|>< ⋉><| ⋊ Miscellaneous' ′'' ″''' ‴'''' ⁗ aleph ℵ del ∂ grad ∇ oc, prop ∝/_ ∠/_\ △|| ∥~= ≅~~ ≈ sub ⊂ sup ⊃ sube ⊆ supe ⊇<>, diamond ⋄[], square □<| ⊲|> ⊳ Relational in ∈!in ∉-=,== ≡<= ≤>= ≥-< ≺>- ≻-<= ⪯>-= ⪰<<< ≪>>> ≫ Logical and and if if or or otherwise otherwise not ¬ AA ∀ EE ∃|-- ⊢ TT ⊤_|_ ⊥|== ⊨ Arrows<-, larr ← uarr ↑->, rarr → darr ↓ harr ↔->> ↠>-> ↣|-> ↦ lArr ⇐=>, rArr ⇒<=>, iff, hArr ⇔>->> ⤖ Punctuations., INVISIBLE SEPARATOR( zero width)... …:. Standard functions cos cos cosh cosh cot cot csc csc cosec cosec det det dim dim gcd gcd lcm lcm ln ln log log max max min min mod mod sec sec sin sin sinh sinh tan tan tanh tanh Greek Delta Δ Gamma Γ Lambda Λ Omega Ω Phi Φ Pi Π Psi Ψ Sigma Σ Theta Θ Xi Ξ alpha α beta β chi χ epsilon ɛ eta η gamma γ kappa κ lambda λ mu μ nu ν omega ω phi φ phiv ϕ pi π psi ψ rho ρ sigma σ tau τ theta θ upsilon υ xi ξ zeta ζ Additional identifiers oo ∞ O/ ∅ CC ℂ NN ℕ QQ ℚ RR ℝ ZZ ℤ tan = sin/cos sinh x = (e^x - e^ -x) / 2 ln x/y = ln x - ln y`Gamma`(theta | alpha, beta) = beta^alpha / Gamma(alpha) theta^(alpha - 1) e^(-beta theta)(🍔-🐄 / 🌈)^2 = 🥰 lim_(x->oo)`sup`(O/) = -oo min._(x in NN) = 0
Or read this on Hacker News