Page MenuHomePhabricator

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

Description

<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

Details

Reference
bz35191

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.

Attached:

  • Bug 36144 has been marked as a duplicate of this bug. ***

https://gerrit.wikimedia.org/r/#/c/64523/ 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 http://docs.mathjax.org/en/latest/options/Safe.html#configure-safe

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."