{"id":23082593,"url":"https://github.com/runarberg/mathup","last_synced_at":"2025-08-16T00:31:31.501Z","repository":{"id":28521951,"uuid":"32038723","full_name":"runarberg/mathup","owner":"runarberg","description":"Easy MathML authoring tool with a quick to write syntax","archived":false,"fork":false,"pushed_at":"2025-07-22T08:59:21.000Z","size":6115,"stargazers_count":85,"open_issues_count":2,"forks_count":11,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-08-09T01:41:37.276Z","etag":null,"topics":["asciimath","javascript","markup-language","mathematical-expressions","mathml"],"latest_commit_sha":null,"homepage":"http://mathup.xyz/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/runarberg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-03-11T20:09:46.000Z","updated_at":"2025-04-06T10:51:00.000Z","dependencies_parsed_at":"2024-06-07T22:42:25.301Z","dependency_job_id":"256882bb-23f3-44bd-babc-12d5f6ca7215","html_url":"https://github.com/runarberg/mathup","commit_stats":{"total_commits":179,"total_committers":7,"mean_commits":"25.571428571428573","dds":"0.11173184357541899","last_synced_commit":"bf765da56941f1b61b5bb19e3ae07dea5f80e4c9"},"previous_names":["runarberg/ascii2mathml"],"tags_count":44,"template":false,"template_full_name":null,"purl":"pkg:github/runarberg/mathup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runarberg%2Fmathup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runarberg%2Fmathup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runarberg%2Fmathup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runarberg%2Fmathup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/runarberg","download_url":"https://codeload.github.com/runarberg/mathup/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runarberg%2Fmathup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270651070,"owners_count":24622442,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-15T02:00:12.559Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asciimath","javascript","markup-language","mathematical-expressions","mathml"],"created_at":"2024-12-16T14:55:49.725Z","updated_at":"2025-08-16T00:31:31.493Z","avatar_url":"https://github.com/runarberg.png","language":"JavaScript","readme":"# mathup\n\n[![Build Status](https://github.com/runarberg/mathup/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/runarberg/mathup/actions/workflows/ci.yml?query=branch%3Amain)\n[![Coverage Status](https://coveralls.io/repos/github/runarberg/mathup/badge.svg)](https://coveralls.io/github/runarberg/mathup)\n[![License](https://img.shields.io/npm/l/mathup)](LICENSE)\n[![npm](https://img.shields.io/npm/v/mathup.svg)](https://www.npmjs.com/package/mathup)\n[![Downloads](https://img.shields.io/npm/dm/mathup)](https://npm-stat.com/charts.html?package=mathup)\n\n#### Installation\n\n##### npm\n\n```bash\nnpm install mathup\n```\n\n```js\nimport mathup from \"mathup\";\n```\n\n##### Client\n\nDownload or link one or more of the [released assets](https://www.jsdelivr.com/package/npm/mathup?tab=files\u0026path=dist)\nand include the **module**:\n\n```html\n\u003cscript type=\"module\" src=\"mathup.js\"\u003e\u003c/script\u003e\n\u003clink rel=\"stylesheet\" href=\"mathup.css\" /\u003e\n```\n\n…the **custom element**:\n\n```html\n\u003cscript type=\"module\" src=\"math-up-element.js\"\u003e\u003c/script\u003e\n```\n\n…or the **script**:\n\n```html\n\u003cscript src=\"mathup.iife.js\"\u003e\u003c/script\u003e\n\u003clink rel=\"stylesheet\" href=\"mathup.css\" /\u003e\n```\n\n#### Usage\n\n```js\nconst expression = \"1+1 = 2\";\nconst options = {}; // optional\nconst mathml = mathup(expression, options);\n\nmathml.toString();\n// =\u003e \"\u003cmath\u003e\u003cmrow\u003e\u003cmn\u003e1\u003c/mn\u003e\u003cmo\u003e+\u003c/mo\u003e\u003cmn\u003e1\u003c/mn\u003e\u003c/mrow\u003e\u003cmo\u003e=\u003c/mo\u003e\u003cmn\u003e2\u003c/mn\u003e\u003c/math\u003e\"\n\nconst mathNode = mathml.toDOM();\n// =\u003e [object MathMLElement]\n\n// Update existing \u003cmath\u003e node in place\nmathup(\"3-2 = 1\", { bare: true }).updateDOM(mathNode);\n```\n\n##### Custom Element\n\n```html\n\u003cmath-up display=\"inline\" dir=\"ltr\" decimal-mark=\",\" col-sep=\";\" row-sep=\";;\"\u003e\n  1+1 = 2\n\u003c/math-up\u003e\n```\n\n##### Command Line\n\n```bash\nnpm install -g mathup\n\nmathup [options] -- \u003cexpression\u003e\n\n# or from stdin\necho \u003cexpression\u003e | mathup [options]\n```\n\n#### Options (with defaults)\n\n\u003c!-- prettier-ignore --\u003e\n```js\nconst options = {\n  decimalMark: \".\",   // -m,  --decimalmark=\".\"\n  colSep: \",\",        // -c,  --colsep=\",\"\n  rowSep: \";\",        // -r,  --rowsep=\";\"\n  display: \"inline\",  // -d,  --display\n  dir: \"ltr\",         //      --rtl\n  bare: false,        // -b,  --bare\n}\n```\n\n## Reference\n\n[See here](http://runarberg.github.io/mathup/#reference)\n\n## Easy MathML authoring tool with a quick to write syntax\n\nThis package exposes a single function `mathup` that intuitively takes\nsimple mathematical expressions—written in a markup language inspired\nby [_AsciiMath_](http://asciimath.org/)—and outputs structured\n[_MathML_](http://www.w3.org/Math/).\n\nYou can use it on the command line or on the server as an\n[npm](https://npmjs.com) package, or in the browser by including the\nscript source. In the browser, you choose how to parse the math in\nyour document—by looking hard for any math-y substrings, parsing all\nexpressions wrapped in `$`…`$`, or using some other excellent tools out\nthere that does it for you. And you can choose what to do with the\noutput as well—piping it to another program, inject it streight to the\nDOM, or just logging it to the console.\n\n## Why not just use _MathJax_?\n\n[_MathJax_](http://www.mathjax.org/) is an excellent tool that you can\nsafely use if all you want to do is include complex mathematical\nexpressions in a document. However, MathJax is a complex piece of\nsoftware that does a great deal more than just translate simple\nexpression into structured form, and if that is all you want to do,\nthen MathJax is definitely overkill. Mathup promises to be a lot\nfaster (by doing less) then MathJax. While MathJax will search for\nexpressions, parse them, translate and render them. Mathup only parses\nand translates them, and let the browser do the rendering.\n\n## Why AsciiMath / Why not TeΧ?\n\nI wrote this tool, because I wanted to be able to author mathematical\nexpressions quickly, with no overhead (imagine `1/2` instead of\n`\\frac{1}{2}`). TeΧ expressions can easily become verbose and annoying\nto write (especially on keyboards with complex access to the\n\u003ckbd\u003e \\ \u003c/kbd\u003e, \u003ckbd\u003e{\u003c/kbd\u003e, and \u003ckbd\u003e}\u003c/kbd\u003e keys). However, the\npurpose of this package is _not_ to give people complete control over\nMathML in a non-verbose way, the purpose is to make it simple for\npeople to write simple expression. Of course I’ll try to give as much\nexpressive power as possible in the way, but I won’t promise to make\nall complex things possible.\n\nIf you want full support of MathML, and don’t want to write all those\ntags perhaps you should look for another tool. There are other great\nefforts to enable people to author MathML in TeX format, take a look\nat [TeXZilla](https://github.com/fred-wang/TeXZilla) for example.\n\n## Testing\n\nRun the test suites with:\n\n```bash\nnpm test\n```\n\nAs for manual and visual tests, if you are running node 13 or newer,\nyou don’t need to compile between edit and run as the code is written\nwithout transpilation in mind. The code works in both browsers and\nnode without any transcompilation.\n\nFor a simple test do:\n\n```bash\n./bin/mathup.js -- 'my expression'\n```\n\nYou can open a\n[playground](http://localhost:8000/demo/playground.html) and [test\ncases](http://localhost:8000/demo/test-cases.html) on\n\u003chttp://localhost:8000/demo\u003e by running:\n\n```bash\nnpm run server\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunarberg%2Fmathup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frunarberg%2Fmathup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunarberg%2Fmathup/lists"}