mathjax / mathjax/MathJax

Math input error when mixing MathML and a HTML hyperlink

Open
#3,593 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Code Example Expected Behavior v4
Dominant language
JavaScript
Stars
10.9k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Issue Summary

MathJax 4 produces a math input error when rendering a MathML equation that also has other HTML elements in it.

OS: Windows 11
Browser: Mozilla Firefox 153.0

Expected output (using Firefox's native rendering):

Triangle inequality with a superscipt linking to the Wikipedia page.
Steps to Reproduce:

Render the MathML equation in question:

<math xmlns="http://www.w3.org/1998/Math/MathML">
        <mo>|</mo>
        <mi>x</mi>
        <mo>+</mo>
        <mi>y</mi>
        <mo>|</mo>
        <mo>&lt;</mo>
        <mo>|</mo>
        <mi>x</mi>
        <mo>|</mo>
        <mo>+</mo>
        <mo>|</mo>
        <mi>y</mi>
        <mo>|</mo>
        <mtext>
        <sup>
            <a href="https://en.wikipedia.org/wiki/Triangle_inequality">Triangle inequality (Wikipedia)</a>
        </sup>
        </mtext>
      </math>

It is a bug, since it should be possible to have HTML markup inside MathML markup as per MathML Core 2.2.1 HTML and SVG.

Technical details:
  • MathJax Version: 4
  • OS: Windows 11
  • Browser: Mozilla Firefox 153.0

I am using the following the default MathJax configuration.

Loading MathJax via:

<script src="https://cdn.jsdelivr.net/npm/mathjax@4/tex-mml-chtml.js" defer></script>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided MathML example with MathJax 4's default tex-mml-chtml.js configuration in Firefox, then trace the math input error triggered by the HTML hyperlink inside mtext. Done means the equation renders without an input error while retaining the hyperlink.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.