`MathDocument.convert()` does not associate a `MathItem` with the `MathDocument`
Created by: rhansen
Issue Summary
When I follow the documentation to convert a math string to HTML or SVG, no MathItem
is associated with the MathDocument
(as far as I can tell). In particular, MathJax.startup.document.getMathItemsWithin()
does not return anything for the element or its containers.
Is this intentional? If so, how do I access the MathItem
?
Steps to Reproduce:
https://jsfiddle.net/9rLhjskz/
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>
<script>
const elt = MathJax.tex2svg('e^{i\\pi}=-1');
document.body.append(elt);
const [mathItem] = MathJax.startup.document.getMathItemsWithin(document.body);
if (mathItem == null) alert('no MathItem!');
</script>
I get the same result if I instead use MathDocument.convert()
directly:
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>
<script>
const elt = MathJax.startup.document.convert('e^{i\\pi}=-1');
document.body.append(elt);
const [mathItem] = MathJax.startup.document.getMathItemsWithin(document.body);
if (mathItem == null) alert('no MathItem!');
</script>
Technical details:
- MathJax Version: 3.2.0
- Client OS: Ubuntu 20.04
- Browser: Firefox 95.0.1