代码拉取完成,页面将自动刷新
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width">
<title>Add a data-mathml attribute to each math element</title>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script>
MathJax = {
startup: {
ready: function () {
//
// Do the usual startup ready actions (create document, input/output jax, etc).
//
MathJax.startup.defaultReady();
const toMML = MathJax.startup.toMML;
//
// Add a post-filter to the output jax to add the extra attributes
//
MathJax.startup.output.postFilters.add((args) => {
const math = args.math, node = args.data;
const original = (math.math ? math.math :
math.inputJax.processStrings ? '' : math.start.node.outerHTML);
node.setAttribute('data-original', original);
node.setAttribute('data-mathml', toMML(math.root).replace(/\n\s*/g, ''));
});
}
}
};
</script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
</head>
<body>
<p>
This math will have a <code>data-mathml</code> attribute containing
the MathML representation of the expression, and a
<code>data-original</code> attribute holding the original TeX format
of the expression. Inspect the document DOM to see these in place
(on the <code>mjx-container</code> element).
</p>
$$\sqrt{\frac{1+x}{1-x}}$$
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。