mathjax / MathJax-node

MathJax for Node
Apache License 2.0
614 stars 97 forks source link

Cannot read properties of null (reading 'childNodes') #489

Closed zbh876325764 closed 1 year ago

zbh876325764 commented 1 year ago

I have a problem,This is the minimum implementation.


var mjAPI = require("mathjax-node");
try{
mjAPI.typeset({
  math: '\n<math display=\"block\" xmlns=\"http://www.w3.org/1998/Math/MathML\">\n\t<mrow>\n\t\t<mi>๐œŸ</mi>\n\t\t<msub>\n\t\t\t<mi>๐‚</mi>\n\t\t\t<mi>๐‘ซ</mi>\n\t\t</msub>\n\t\t<mo>=</mo>\n\t\t<mi>๐Ÿ•</mi>\n\t\t<mo>.</mo>\n\t\t<mi>๐Ÿ</mi>\n\t\t<mi>๐Ÿ”</mi>\n\t\t<mo>ร—</mo>\n\t\t<mi>๐Ÿ</mi>\n\t\t<msup>\n\t\t\t<mi>๐ŸŽ</mi>\n\t\t\t<mrow>\n\t\t\t\t<mo>โˆ’</mo>\n\t\t\t\t<mi>๐Ÿ•</mi>\n\t\t\t</mrow>\n\t\t</msup>\n\t\t<msqrt>\n\t\t\t<msub>\n\t\t\t\t<mi>๐‘ป</mi>\n\t\t\t\t<mo>/</mo>\n\t\t\t\t<mi>๐</mi>\n\t\t\t\t<mrow>\n\t\t\t\t\t<mi>๐’Ž</mi>\n\t\t\t\t\t<mi>๐’</mi>\n\t\t\t\t\t<mi>๐’</mi>\n\t\t\t\t</mrow>\n\t\t\t</msub>\n\t\t</msqrt>\n\t\t<mo>โ‹…</mo>\n\t\t<msub>\n\t\t\t<mi>๐‚</mi>\n\t\t\t<mi>๐ŸŽ</mi>\n\t\t</msub>\n\t</mrow>\n</math>',
  format: "MathML",
  html: true,
  css: true,
}, function (data) {console.log(data)});
}catch(error){
console.log(error)
}
pkra commented 1 year ago

The configuration asks for HTML/CSS output ( html: true,) so there will be no SVG output. Try svg: true, instead.

pkra commented 1 year ago

Also: mathjax-node is outdated. Since MathJax v3 you can use it in nodejs directly, see https://github.com/mathjax/MathJax-demos-node/ for examples.

zbh876325764 commented 1 year ago

้…็ฝฎ่ฆๆฑ‚ HTML/CSS ่พ“ๅ‡บ ( html: true,)๏ผŒๅ› ๆญคไธไผšๆœ‰ SVG ่พ“ๅ‡บใ€‚่ฏ•่ฏ•svg: true,ๅงใ€‚

sorry,I write it wrongly

zbh876325764 commented 1 year ago

Also: mathjax-node is outdated. Since MathJax v3 you can use it in nodejs directly, see https://github.com/mathjax/MathJax-demos-node/ for examples. Thank you, I'll try