Unknown node type "body" when compiling MathML in v3.0.1
Created by: hubgit
Using mathjax-full@3.0.0
it was possible to use this code to convert MathML to SVG:
import { MathML } from 'mathjax-full/js/input/mathml'
import { SVG } from 'mathjax-full/js/output/svg'
import { HTMLAdaptor } from 'mathjax-full/js/adaptors/HTMLAdaptor'
import { HTMLDocument } from 'mathjax-full/js/handlers/html/HTMLDocument'
const doc = new HTMLDocument(document, new HTMLAdaptor(window), {
InputJax: new MathML(),
OutputJax: new SVG(),
})
const svg = doc.convert(`<math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mi>A</mi><mo>=</mo></mrow></math>`)
console.log(svg.innerHTML)
Using mathjax-full@3.0.1
an error is thrown when using the same code:
Uncaught Error: Unknown node type "body"
at MathMLCompile.error (MathMLCompile.ts:320)
at MathMLCompile.makeNode (MathMLCompile.ts:125)
at MathMLCompile.compile (MathMLCompile.ts:95)
at MathML.compile (mathml.ts:145)
at HTMLMathItem.AbstractMathItem.compile (MathItem.ts:327)
at Object.renderMath (MathDocument.ts:167)
at RenderList.renderConvert (MathDocument.ts:211)
at HTMLMathItem.AbstractMathItem.convert (MathItem.ts:319)
at HTMLDocument.AbstractMathDocument.convert (MathDocument.ts:633)
It seems to go wrong around this line in MathDocument
:
mitem.start.node = this.adaptor.body(this.document)
which sets mitem.start.node
to the body
of this.document, which suggests that this commit might be to blame.