1
$\begingroup$

When I have enabled "fast preview" in the MathJax context menu "Math Settings $\to$ Math Renderer $\to$ Fast Preview", MathJax will attempt to render formulas in the "side-by-side markdown" comparison view for edit histories and suggested edits. This view is otherwise supposed to show raw unrendered source (and does so without fast preview enabled).

This error only shows when "side-by-side markdown" is the preferred mode when the page loads. It looks correct if I switch from "inline" to "side-by-side markdown" after the page load, but reappears if I then reload the page.

Here's how a random example looks for me (Firefox 35.0.5, Windows 7) with Fast Preview enabled: screenshot goes here Note that the red/green highlighting seems to confuse MathJax into losing sync of the beginning/ending dollar signs.

This behavior doesn't show in Chrome 39 or IE 11.

$\endgroup$
7
  • $\begingroup$ In your example, the side-by-side markdown view shows as you want it for me, completely unrendered, plain source. Can you add a screenshot of how it looks for you? $\endgroup$ Jan 9, 2015 at 12:56
  • $\begingroup$ @DanielFischer: Screenshot added. $\endgroup$ Jan 9, 2015 at 14:01
  • $\begingroup$ @DanielFischer: Upon further experimentation it looks like I only get this behavior because I've turned on "fast preview" in the MathJax settings. That makes for a somewhat different bug report; will edit. $\endgroup$ Jan 9, 2015 at 14:06
  • $\begingroup$ This is how it looks for me (SeaMonkey 2.31, openSuSE 12.3). I also have turned on "Fast Preview" in the MathJax settings, so it's not that (alone). Could be the browser or OS, let me take a look in other browsers. $\endgroup$ Jan 9, 2015 at 14:10
  • $\begingroup$ Also fine in Konqueror and Firefox 34.0.5, with the same MathJax settings. Can you check in other browsers? $\endgroup$ Jan 9, 2015 at 14:21
  • $\begingroup$ @DanielFischer: It shows up correctly when I switch to "side-by-side markdown" from one of the other views. It seems the bug appears only when "side-by-side markdown" is the initial view at page load time. Bug does not appear with Chrome or IE. $\endgroup$ Jan 9, 2015 at 14:32
  • $\begingroup$ Indeed, when I load the page with side-by-side markdown as the preferred view, I get it too. $\endgroup$ Jan 9, 2015 at 14:45

1 Answer 1

3
$\begingroup$

Pages can control what parts are processed by MathJax using the class tex2jax_ignore; the contents of any container element that has this class will not be processed by MathJax. SE uses this to prevent the difference section from being processed by MathJax.

Unfortunately, the tex2jax_ignore class seems to be added dynamically to the page after it arrives at the browser (the original HTML page doesn't have the class in it, and it looks like revisions.en.js includes code to add the tex2jax_ignore class). It appears that there is a race condition between revisions.en.js and MathJax: if MathJax runs first, then the tex2jax_ignore class will not have been applied yet, and the differences will be processed by MathJax, but if revisions.en.js runs first, then the class will be in place when MathJax runs, and it will ignore the difference section.

It turns out that this has nothing to do with the fast preview, and more to do with the SE configuration and the timing of files as they arrive at the browser. I managed to see the math rendered once (the first time I viewed the page, presumably because I had MathJax in cache, but not the revisions file), but haven't been able to get it to do so again, regardless of the setting of the fast preview.

It would be better if SE had tex2jax_ignore in the original HTML file rather than adding it later. Alternatively, they could configure tex2jax to use the markdown-diff class as one of the classes to be ignored (like tex2jax_ignore) rather than adding tex2jax_ignore after the page is loaded.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .