process MathML nested inside mtext
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.9k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Is your feature request related to a problem? Please describe.
The <mtext> element is allowed to contain arbitrary HTML, and this is now properly supported via allowHtmlInTokenNodes. There are two inconsistencies, though:
- if a
<math>element appears as direct children of<mtext>, MathJax returns the error 'Improper nesting of math tags' - otherwise,
<math>is accepted, but MathJax does not process it
Describe the solution you'd like
<math> descendants of <mtext> should be processed like any other <math>.
Describe alternatives you've considered
To work around 1, it is enough to generate better MathML and split <mtext>, or to wrap the content into a further <div>. For 2, MathML support in browsers is not too bad. So all in all this is a minor issue.
Additional context
This is a rare circumstance, as far as I know. The mathtools documentation has an (artificial!) LaTeX example that can't be replicated properly without nesting MathML-in-HTML-in-MathML, but I haven't encountered it in practice.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing MathML handling for and the allowHtmlInTokenNodes path. Reproduce both cases described in the issue—direct and nested
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100