# The proposed changes to the text editor would break this site

You have probably seen already a link, on the Featured on Meta sidebar, to an announcement of an upcoming upgrade to the text editor on Stack Exchange, Opt-in alpha test for a new Stacks editor.

As a whole, the project looks extremely useful, and it looks like it will do a lot of good for general text editing, particularly for new users who are not accustomed to writing in Markdown.

However, the current design philosophy is to get rid of the simultaneous preview of the page, which implies getting rid of the simultaneous preview of MathJax. From what I can see, the envelope of possible design choices includes some outcomes that could keep this site working, but it also includes many choices that would break this site as well as any other SE sites that depend on MathJax to function. Moreover, from what I can tell, the current trajectory is towards those outcomes that would break this site.

Thankfully, the dev team has asked for community feedback at the right (early) stage of the process, and this trajectory can be corrected. I have written up the issues I see with the development as an answer on the feedback page, and, if you agree with the issues I perceive, I would ask you to support that answer with your votes and with voicing your opinion there. The dev team has a lot of work in front of it, and MathJax will not be made a priority unless the community makes it clear, through energetic and compelling (but obviously polite and constructive) feedback, that the issues require attention and they require attention before harmful design choices become set in stone.

</soapbox> =)

• I expect that the new editor won't be deployed on the SE network, only on the non-MathJax sites. – peterh Jan 28 at 16:46
• I think you are missing the point about what the purpose of SE is. The time you spend writing answers containing MathJax doesn't generate any revenue, therefore its has no value. Just get on with clicking on the adverts and earning money for the site management. – alephzero Jan 29 at 18:06
• @alephzero I don’t see ads on any SE site. But the content I produce using the currently-functioning toolkit attracts the interest of other users, who do see (and click on) ads. – rob Mod Jan 31 at 15:11
• @alephzero: It may be too cynical. The VCs may be looking for highly engaged users. – Peter Mortensen Feb 3 at 10:43

Here is one option put forward by the SE developers: switching from MathJax to prosemirror-math. For a quick look at how it works, I'll just pull this from their readme:

## Examples

Unlike other editors, this plugin treats math as part of the text itself, rather than as an "atom" that can only be edited through a dialog box. For example, inline math nodes can be edited directly by bringing the cursor inside of them:

Display math supports multiline editing, as shown below:

The inner workings of the text editing are based on prosemirror, which is the software base for the new Stacks editor, so that's good for SE.

The mathematics rendering is done using KaTeX, which is an alternative to MathJax. KaTeX was last discussed on this site in 2017 and the conclusion then was that it was not mature enough, but the software has moved on since then, and it's probably due for a re-evaluation.

• Many of the deal-breakers mentioned back then (say, the lack of support for \newcommand) have since been fixed.
• On the other hand, at the very least, KaTeX is not fully interoperable with MathJax. At the very least, the align environment needs to be replaced by aligned, which entails editing 7.5k posts on physics, 1.8k on MO and 50k+ on math.se. For fancier behaviour we would need to have a very detailed look.
• Independently of the maturity of KaTeX, it's unclear to me how mature the prosemirror-math software is. Their To Do list includes "Test in FireFox, Safari, Edge" and their last commit was four months ago, and that's not a good sign.
• It's unclear to me how fast the preview would be on prosemirror-math, and how it would be affected by a slow connection speed. If there is a danger that the preview slows down on lower bandwidths, then that is exclusionary and unacceptable -- but it isn't detected unless specifically tested for, so it needs to be explicitly checked.

In any case, independently of those technical hiccups, we as users should answer the question: is the style of editing offered by this solution something we can work with? I for one find it intriguing, but I don't want to say 'yes' without trying it out (and it's unclear whether there are any solutions that can do that at the moment).

Edit: the prosemirror-math developer has promised a demo version is coming soon (while, on the other hand, stating that it is "more of a proof-of-concept than a production-ready library", which indicates just how long of a road it has ahead of it).

• I hear what you're saying about slowing down on lower bandwidths, but isn't that already an issue with MathJax? Or are the times when it doesn't render immediately due to other issues? – Michael Seifert Feb 2 at 21:51
• @MichaelSeifert The intro page on katex.org explicitly mentions server-side rendering, which is not the case in MathJax. Presumably this would not be used on a live preview, but if it is, then it does need to be tested on restricted bandwidths. – Emilio Pisanty Feb 3 at 12:06
• I'm unsure how to interpret the votes on this answer given the lack of comment feedback. Is it because people are interested in the format? – Emilio Pisanty Feb 3 at 12:19
• I'd say that it looks like a reasonable replacement, though I'd honestly miss the ability to make a change in the markdown and see the change immediately. In this case, you'd have to move your cursor out of the LaTeX code block to get it to render. This would be quicker than submitting a preview to a server and waiting for it to reply (probably — see your comments about server-side rendering above), but it still be a little annoying compared to the live preview we have now. – Michael Seifert Feb 3 at 12:50
• @Michael Apparently, ctrl+space will navigate out of a math block and trigger a preview, so maybe speed is not such a big issue. I'd be more worried about repeatedly losing my place when editing a large expression if I want to see what it looks like. – Emilio Pisanty Feb 3 at 12:52
• Somewhat unrelated, but is there a good way (in the current editor) to get the live preview side-by-side with the markdown? I find scrolling down a bit annoying. – Jonathan Jeffrey Feb 8 at 1:45
• @JonathanJeffrey No, there is no current functionality that will do that. On the main MSE thread there are many people asking for that to be included, and the dev team has consistently declined to build it. Their stated reason is that it does not fit within the page layout, particularly on smaller screens, and they are committed to a 'responsive' layout that uses the same layout tools for screens of all sizes. For more information see the main MSE thread. – Emilio Pisanty Feb 8 at 11:36
• Oh I love this solution. – Akira Feb 13 at 21:33