Skip to content

Conversation

vmcj
Copy link
Member

@vmcj vmcj commented Sep 22, 2025

As alternative for MathJax, this PR fixes removing MathML tags.

I verified with: https://support.freedomscientific.com/SurfsUp/MathML-Samples.html
More elements can be found at: https://developer.mozilla.org/en-US/docs/Web/MathML/Reference/Element

All seem to be reasonable safe, e.q. no XSS unless we allow for onload,href etc. we still remove the tag etc.

For now we only allow for the tags and most of the time no attributes as those are probably too advanced for a contest setting. The only reason some are added is for demonstration and to make the examples work.

mathml

More elements can be found at: https://developer.mozilla.org/en-US/docs/Web/MathML/Reference/Element

All seem to be reasonable safe, e.q. no XSS unless we allow for onload,href etc.

For now we only allow for the tags and most of the time no attributes as those are probably too advanced for
a contest setting.
@meisterT
Copy link
Member

Looking at the source code of these examples, picking a random one the syntax looks quite complex. I don't think teams will want to deal with it (without internet!) during a contest:

<math xmlns='http://www.w3.org/1998/Math/MathML' display='block'>
<mrow>
  <mrow>
    <msup>
      <mi>x</mi>
      <mn>2</mn>
    </msup>
    <mo>+</mo>
    <mrow>
      <mn>4</mn>
      <mo>&InvisibleTimes;</mo>
      <mi>x</mi>
    </mrow>
    <mo>+</mo>
    <mn>4</mn>
  </mrow>
  <mo>=</mo>
  <mn>0</mn>
</mrow>
</math>

@vmcj
Copy link
Member Author

vmcj commented Sep 24, 2025

Looking at the source code of these examples, picking a random one the syntax looks quite complex. I don't think teams will want to deal with it (without internet!) during a contest:

<math xmlns='http://www.w3.org/1998/Math/MathML' display='block'>
<mrow>
  <mrow>
    <msup>
      <mi>x</mi>
      <mn>2</mn>
    </msup>
    <mo>+</mo>
    <mrow>
      <mn>4</mn>
      <mo>&InvisibleTimes;</mo>
      <mi>x</mi>
    </mrow>
    <mo>+</mo>
    <mn>4</mn>
  </mrow>
  <mo>=</mo>
  <mn>0</mn>
</mrow>
</math>

Yes, this would most likely be more beneficial to jury members who do have internet. I just played around with this as it would remove most of the issues in the MathJax PR and although not perfect would be relatively harmless and easier to maintain.

@eldering
Copy link
Member

Agreed with @meisterT : this is too complex to use and I think doesn't really add much value.

@vmcj vmcj closed this Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants