# MathJax tries to render "side-by-side markdown" when Fast Preview is enabled

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

• 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? Jan 9 '15 at 12:56
• @DanielFischer: Screenshot added. Jan 9 '15 at 14:01
• @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. Jan 9 '15 at 14:06
• 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. Jan 9 '15 at 14:10
• Also fine in Konqueror and Firefox 34.0.5, with the same MathJax settings. Can you check in other browsers? Jan 9 '15 at 14:21
• @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. Jan 9 '15 at 14:32
• Indeed, when I load the page with side-by-side markdown as the preferred view, I get it too. Jan 9 '15 at 14:45

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