Page MenuHomePhabricator

Styles in math-tag are ignored when using MathJax
Closed, DeclinedPublic


<math style="border: 1px blue; border-style: dashed; padding: 1em;">a^2+b^2=c^2</math> comes without the border in MathJax.

Version: unspecified
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:17 AM
bzimport added a project: Math.
bzimport set Reference to bz35191.

The style probably needs to be put on an outer <span> that doesn't get replaced.

Noticed the original HTML wasn't even outputting "style". Fixed this in Ia267aa211cb1bcb2023cd3f87bbc83c983ffc91f

MathJax still removes the styling, will require another patch.

Created attachment 10686
Proof of concept

OK, now the attributes have to be moved from the tex span to the jax math script node (this should happen in wiki2jax.js).

Once they are there, MathJax needs to be adapted to copy the attributes AGAIN from the script node and apply them to the HTML formatted node. I did a quick mockup to verify that it can work (see attached patch), but it will require changes to MathJax and the problem is in merging and filtering the attributes that we need of course. That is something we have function for in MediaWiki, but those are not available inside MathJax right now.


  • Bug 36144 has been marked as a duplicate of this bug. *** is a proposed change to add safe mode. As currently configured, I believe this would block all inline styles, and classes that don't start with MJX-. See

The safe mode change is (as it sounds like) intended to promote security (avoiding XSS), but it conflicts with this bug.

physik wrote:

I guess the solution is
"The style probably needs to be put on an outer <span> that doesn't get replaced."