Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • M MathJax
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 304
    • Issues 304
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • MathJax
  • MathJax
  • Issues
  • #2330
Closed
Open
Issue created Feb 13, 2020 by Administrator@rootContributor

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.

Assignee
Assign to
Time tracking