import {MathJax} from "mathjax3/mathjax.js"; export {MathJax} from "mathjax3/mathjax.js"; import "mathjax3/handlers/html.js"; import {MathML} from "mathjax3/input/mathml.js"; let OPTIONS = { InputJax: new MathML() }; let HTML = ` This is some math: x.
text

y end

and more here
`; var html; try { // // Use browser document, if there is one // html = MathJax.document(document,OPTIONS); document.documentElement.setAttribute("xmlns:m","http://www.w3.org/1998/Math/MathML"); document.body.insertBefore(document.createElement("hr"),document.body.firstChild); var div = document.createElement('div'); div.innerHTML = HTML; div.style.marginBottom = "1em"; document.body.insertBefore(div,document.body.firstChild); } catch (err) { // // Otherwise, make a new document (measurements not supported here) // html = MathJax.document( '' + 'Test MathJax3' + HTML + '', OPTIONS ); } MathJax.handleRetriesFor(function () { html.findMath(); for (const math of html.math) { console.log(math.math,math.display); console.log(""); }; }).catch(err => { console.log(err.message); console.log(err.stack.replace(/\n.*\/system\.js:(.|\n)*/,"")); });