Page MenuHomePhabricator

Visual coloured math diffs
Closed, DeclinedPublic


Author: felipe.sanches

This patch renders math equations in the diff pages colouring it the same way
the diffengine colours text diffs.

See the example at the above URL.

Version: 1.10.x
Severity: enhancement



Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 9:31 PM
bzimport set Reference to bz8954.
bzimport added a subscriber: Unknown Object (MLST).

felipe.sanches wrote:

Coloured math diffs patch


ayg wrote:

This appears to also make the math background transparent. That has been
rejected before, because it's possible that the user will be using a very dark
background color, making the text (which is always black) hard or impossible to
read. Try to keep unrelated changes out of patches, so that they're easier to

Other than that, it looks to be quite a nice change. I'm slightly concerned
with usability, though, because presumably most non-image clients won't render
the \color bit as distinctly as they'll probably render the <ins> or <del>.
Perhaps set the alt text on the images to the empty string, and put the text of
the math tag immediately below it. I.e., instead of

<img src="..." alt="x{\color{red}^2}" />


<img src="..." alt="" />
<math>x<ins class="diffchange">^2</ins></math>. Of course, that means that
visual clients will also see the superfluous diff of the actual math text, but
perhaps that's a feature: it will quickly show them what bits they need to
change in the wikitext to partially reverse the change, say.

felipe.sanches wrote:

I thought that it would look better. Maybe we could solve it by setting the math
foreground color to match the CSS settings. But I have no idea of how to fetch
this info using php code.

We can also get rid of this problem if we let the user select this feature as a
user preference.

ayg wrote:

Please confine any background-transparency remarks to bug 6954.

ayg wrote:

As Rob reminds me at bug 8981 comment 1, as written this will have no effect on
WMF sites, because we use wikidiff2 for diffs.

*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*

sumanah wrote:

I'm adding the "reviewed" keyword here because Aryeh has reviewed the patch. Thanks for the patch, Felipe; do you have interest and time to rework it?

CC'ing the Math maintainers in case they can provide input how complicated / feasible this could be.

TheDJ added a project: Math.
TheDJ subscribed.

This patch is very old and I think that with the future visual diffs, this strategy proposed here is also no longer required.