{"id":31818825,"url":"https://github.com/sora2455/mathmlnow","last_synced_at":"2025-10-11T11:18:18.870Z","repository":{"id":48027833,"uuid":"136703884","full_name":"Sora2455/MathMlNow","owner":"Sora2455","description":"A server-side rendering technique that allows MathML to be displayed in browsers with a scriptless falback that works all the way back to IE6","archived":false,"fork":false,"pushed_at":"2024-06-18T06:44:01.000Z","size":1153,"stargazers_count":4,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-10T05:26:12.091Z","etag":null,"topics":["fallback","mathml","node-module","nodejs"],"latest_commit_sha":null,"homepage":null,"language":"HTML","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/Sora2455.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}},"created_at":"2018-06-09T08:11:15.000Z","updated_at":"2024-04-23T02:20:16.000Z","dependencies_parsed_at":"2023-02-01T05:00:20.836Z","dependency_job_id":null,"html_url":"https://github.com/Sora2455/MathMlNow","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/Sora2455/MathMlNow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sora2455%2FMathMlNow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sora2455%2FMathMlNow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sora2455%2FMathMlNow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sora2455%2FMathMlNow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sora2455","download_url":"https://codeload.github.com/Sora2455/MathMlNow/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sora2455%2FMathMlNow/sbom","scorecard":{"id":132429,"data":{"date":"2025-08-04","repo":{"name":"github.com/Sora2455/MathMlNow","commit":"2c5af968e97334dbf88fa14be87481230496cee8"},"scorecard":{"version":"v5.2.1-28-gc1d103a9","commit":"c1d103a9bb9f635ec7260bf9aa0699466fa4be0e"},"score":2,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/2 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 28 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"15 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-v638-q856-grg8","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-16T05:30:43.556Z","repository_id":48027833,"created_at":"2025-08-16T05:30:43.556Z","updated_at":"2025-08-16T05:30:43.556Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279007034,"owners_count":26084227,"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-10-11T02:00:06.511Z","response_time":55,"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":["fallback","mathml","node-module","nodejs"],"created_at":"2025-10-11T11:18:16.555Z","updated_at":"2025-10-11T11:18:18.865Z","avatar_url":"https://github.com/Sora2455.png","language":"HTML","readme":"﻿# MathMLNow - MathML with scriptless fallback\n\n\"Mathematical Markup Language (MathML) is a dialect of XML for describing mathematical notation and capturing both its structure and content.\" - [MDN](https://developer.mozilla.org/en-US/docs/Web/MathML)\n\nIn browsers that support it, MathML allows for the display of maths equations in a simple way that never pixilates, can be copied and pasted, and can be read by screen readers.\n\nBut because most browsers do _not_ support MathML, fallback content is necessary. Traditionally, this has been done with the JavaScript library [MathJax](https://www.mathjax.org/), but MathJax suffers from the same problem any JavaScript library has - it is a large download that slows down the users browsing; and doesn't work when JavaScript is turned off (or more likely, broken by another script on the page).\n\nMathMLNow is a Node package that produces a series of HTML tags that show MathML if available, gracefully degrading to an SVG image where MathMl is not supported.\n\nTo see an example of this technique in action, visit [this example page](https://sora2455.github.io/MathMlNow/).\n\n## Getting started\n\nMathMLNow provides a function in the file `./app.js`.\n\nThe file provided is called `MathMLNow`. To generate the MathMLNow used in the example file, the following commands were used:\n\n```JavaScript\n//Remember to escape '\\' characters!\nMathMLNow(\"x=\\\\frac{-b\\\\pm\\\\sqrt{b^2-4ac}}{2a}\", {\n    formatName: \"TeX\",\n    fontSize: 18\n}).then((result) =\u003e console.log(\"Quadratic formula:\\n\" + result));\nMathMLNow(\"e^{i\\\\pi}+1=0\", {\n    formatName: \"TeX\",\n    fontSize: 30\n}).then((result) =\u003e console.log(\"Euler's identity:\\n\" + result));\nMathMLNow(\"\\\\int_0^{\\\\pi/6}\\\\sec\\\\left(y\\\\right)\\\\operatorname dy=\\\\ln\\\\left(\\\\sqrt3i^{64}\\\\right)\", {\n    formatName: \"TeX\",\n    fontSize: 16,\n    verticalMarginPercent: 20\n}).then((result) =\u003e console.log(\"Integral of the secant function:\\n\" + result));\n```\n\nIf you wish to replace inline math instances in a large file (say, a HTML page), then you can pipe it as a [vinyl](https://github.com/gulpjs/vinyl) stream:\n\n```JavaScript\nconst gulp = require('gulp');\nconst rename = require('gulp-rename');\nconst mmlN = require(\"math-ml-now\");\n\ngulp.task('mathReplace', () =\u003e {\n\tconst replacer = new mmlN.MathMlReplacer({\n\t\tformatName: \"TeX\",\n\t});\n\n\treturn gulp.src(\"**/*.pre.html\")\n\t\t.pipe(replacer)\n\t\t.pipe(rename(function (opt) {\n\t\t\topt.basename = opt.basename.replace('.pre', '');\n\t\t\treturn opt;\n\t\t}))\n\t\t.pipe(gulp.dest(function (file) {\n\t\t\treturn file.base;\n\t\t}));\n});\n```\n\nThis will replace any instance of Math inbetween two \"$$\" strings, with font-size, vertical margin percent, horizontal margin percent, and font-color all settable in optional paramaters (in that order) provided after the math string with \"||\" seperators.\n\nFor example, if you wanted the Euler's identity result from up above, you would place\n\n`$$e^{i\\pi}+1=0||30$$`\n\n(math string = \"e^{i\\pi}+1=0\", font-size = 30) wherever you wanted that math to appear.\n\nThe Integral of the secant function from up above would be expressed as\n\n`$$\\int_0^{\\pi/6}\\sec\\left(y\\right)\\operatorname dy=\\ln\\left(\\sqrt3i^{64}\\right)||16||20$$`\n\n(math string = \"\\int_0^{\\pi/6}\\sec\\left(y\\right)\\operatorname dy=\\ln\\left(\\sqrt3i^{64}\\right)\", font-size = 16, vertical margin percent = 20).\n\n## Using with [MathJax](https://www.mathjax.org/)\n\nIf you want to use this as a fallback and MathJax when possible, add this script to your page after where you included the MathJax script (IE9 and up):\n\n```JavaScript\nMathJax.Hub.Register.StartupHook(\"End Extensions\", function(){\n\tvar mathElements = document.querySelectorAll(\"foreignObject[requiredExtensions='http://www.w3.org/1998/Math/MathML'] math\");\n\tvar getParentSvg = Element.prototype.closest ?\n\t\tfunction(el) {return el.closest(\"svg\")} :\n\t\tfunction(el) {return el.parentNode.parentNode.parentNode.parentNode};\n\tfor (var i = 0; i \u003c mathElements.length; i++) {\n\t\tvar mathElement = mathElements[i];\n\t\tvar parentSvg = getParentSvg(mathElement);\n\t\t//Extract the math from the SVG and remove the SVG\n\t\tparentSvg.parentNode.replaceChild(mathElement, parentSvg);\n\t}\n});\n```\n\n## Documentation\n\n`MathMLNow` takes two paramaters - a string representing the maths equation to render (in the same formats [MathJax-node](https://github.com/mathjax/MathJax-node) accepts, as that is what is used internally), and a `MathMLNowOptions` object.\n\n```TypeScript\ninterface MathMLNowOptions {\n    /**\n     * The format of the math input\n     */\n    formatName: \"TeX\" | \"inline-TeX\" | \"AsciiMath\" | \"MathML\";\n    /**\n     * Use to set the effective font-size (in pixels) of the maths expression (defaults to 18)\n     */\n    fontSize?: number;\n    /**\n     * Use to set the color of the rendered equation (defaults to black). Accepts #rgb, #rrggbb or HTML color names\n     */\n    fontColor?: string;\n    /**\n     * The amount of blank space that will be left at the top and bottom of the equation to account for\n     * differences between MathML and SVG - defaults to 0%\n     */\n    verticalMarginPercent?: number;\n    /**\n     * The amount of blank space that will be left at the left and right of the equation to account for\n     * differences between MathML and SVG - defaults to 0%\n     */\n    horizontalMarginPercent?: number;\n}\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsora2455%2Fmathmlnow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsora2455%2Fmathmlnow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsora2455%2Fmathmlnow/lists"}