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
  • #2805
Closed
Open
Issue created Nov 20, 2021 by Administrator@rootContributor

mathml2chtml fails with a newline at the end.

Created by: NSoiffer

Issue Summary

A newline at the end of some MathML in a call to mathml2chtml causes an error (actually, the call never returns) This works

MathJax.mathml2chtml("<math><mi>XXX</mi></math>");

This fails:

MathJax.mathml2chtml("<math><mi>XXX</mi></math>\n");

Steps to Reproduce:

I tried to get a codepen example to run, and codepen complained about "MathJax" not being defined. Here's some HTML that shows the problem (the "AFTER..." is never shown):

<!DOCTYPE html>
<html>
<head>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/mml-chtml.js"></script> 
<script>
function ConvertMathML() {
  MathJax.startup.defaultReady();
  document.getElementById("before").innerHTML = "BEFORE conversion";
  let foo = MathJax.mathml2chtml("<math><mi>XXX</mi></math>\n");
  document.getElementById("after").innerHTML = "AFTER conversion";
}
</script>
</head>
<body>
<button onclick="ConvertMathML()"> Click me to see bug </button>
<p id="before"></p>
<p id="after"></p>
</body>
</html>
Assignee
Assign to
Time tracking