Page MenuHomePhabricator

MathJax doesn't work in LivePreview
Closed, ResolvedPublic

Description

Raw TeX commands are displayed.


Version: unspecified
Severity: normal

Details

Reference
bz36060

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:21 AM
bzimport added a project: Math.
bzimport set Reference to bz36060.
bzimport added a subscriber: Unknown Object (MLST).

More or less the same as in bug 33399. If JavaScript features in LivePreview don't work for core features one can't expect it to work for extensions.
A hook system as suggested in bug 23580 would be the best way to fix this bug.
See also bug 35478.

  • This bug has been marked as a duplicate of bug 33399 ***
  • This bug has been marked as a duplicate of bug 24134 ***

Re-opening as this needs two things:

  • Be able to get modules loaded that extensions add to the page (bug 24134)
  • Be able to run code for "article loaded" when the article html is loaded. Usually this is document-ready which is how we do it now, but in case of preview we have multiple "article loaded" points within the lifecycle of a single page. This will be made possible by 30713.

MathJax module now has a $().renderTex command that can be run to render domelements that contain tex commands. A preview hook can use this to postprocess the preview output.

(For the record, there is now a fix in progress for bug 30713 which is a dependency here.)

Both Ajaxpreview and wikEd now use the renderTex() command to render MathJax in their ajax based preview modes:

Example: https://en.wikipedia.org/w/index.php?title=User%3AJs%2Fpreview2.js&diff=558032369&oldid=520879456

Soon to be improved by making use of https://gerrit.wikimedia.org/r/56762

A specific problem is that after a session in VisualEditor a full refresh is not done and MathJax is not rerun, so the raw latex code is displayed. Apparently according to bug 51565 gadgets should listen to "wikipage.content". I have heard rumours that the fix to bug 48560 will fix this problem.

This ha come up at https://en.wikipedia.org/w/index.php?title=Wikipedia:VisualEditor/Feedback&oldid=593049936

Change 124064 had a related patch set uploaded by TheDJ:
MathJax: Listen for wikipage.content hook

https://gerrit.wikimedia.org/r/124064

Change 124064 merged by jenkins-bot:
MathJax: Listen for wikipage.content hook

https://gerrit.wikimedia.org/r/124064

Patch was merged a while ago - is there more work left to do here (if yes: please reset the bug report status to NEW or ASSIGNED), or can you close this ticket as RESOLVED FIXED?

I just tested and it still doesn't seem to work (PNG images are shown).

For LivePreview, it depends on bug 24134 which isn't fixed yet, because I still need to finish https://gerrit.wikimedia.org/r/#/c/131346/. The patch that was merged was just one of the prerequisites.

VE is a separate issue.

TheDJ claimed this task.

I see i forgot to close this one. This is basically working now, though there apparently is a bug, reported in T90808.