We should have both now as there is a simple workaround
Briefly, we can choose between:
- Just MathJax.
- MathJax plus Stack Snippets that work perfectly well apart from jQuery which needs a minor workaround.
Note that MathJax works perfectly fine either way, so the choice can be summed up as:
- No Stack Snippets at all.
- Stack Snippets that work perfectly well apart from jQuery which needs a minor workaround.
The second option seems the obvious choice to me.
Here's a quick example of the kind of interactive 3D graphics that can be included in answers on sites for which Stack Snippets is activated
(Click "Run Code Snippet" at the bottom of that answer)
More detail
The problem is that using $
in a code snippet multiple times can lead to errors in the way the code is displayed, because MathJax also uses $
. Note that this applies to code snippets in general - not just Stack Snippets, so not having Stack Snippets would not eliminate the problem.
As far as I can tell this mostly affects snippets that use jQuery, so it is perfectly possible to use pure JavaScript or other libraries.
Even for code using jQuery it is possible to work around the problem by simply using jQuery
in place of $
($
is just an alias for jQuery
), which seems a fairly painless workaround.
Since this means it is already possible to use both MathJax and Stack Snippets, I see no reason to wait for things to be perfect. Once we have both, we can push for a fix, which I would guess would then happen faster for all sites affected, due to having more voices calling for it. In the meantime it has zero effect on MathJax, and a manageable effect on Stack Snippets.
There is also some discussion of it over on Programming Puzzles and Code Golf Meta.