# Is it possible to spoiler multi-line mathjax?

I can't work out how to do it.

This:

>! $$a=b$$
>! $$b=c$$
>! $$c=d$$

Produces this:

$$a=b$$ $$b=c$$ $$c=d$$

Whereas this:

> $$a=b$$
> $$b=c$$
> $$c=d$$

Produces this:

$$a=b$$ $$b=c$$ $$c=d$$

Edit: Good joke on me. Evidently the bug only affects the editing preview. When the post is actually posted, it appears as expected. (If you click "edit" on my question and look at the preview, you'll see the problem I thought was present.)

Still would be nice to get fixed but hardly vital.

If you ever want to do such, I would recommend the alternative format:

>! \begin{align} a=b \\ b=c \\ c=d \end{align}

\begin{align} a=b \\ b=c \\ c=d \end{align}

This allows multiple lines, as well as allowing preview while editing. The problem occurs any time you attempt to do dollar signs with multi-line spoilers.

One may also wish to implement another approach:

>! $$a=b \\ b=c \\ c=d$$

$$a=b \\ b=c \\ c=d$$

However, this will preview inline equations rather than allowing the normal display format.

This will be fixed in the next build.

When doing a preview, transformations are run on the rendered HTML, looking for a ! at the beginning of lines in a <blockquote>, stripping them out, and adding the spoiler style. This boils down to code somewhere that ran html.replace('! $$a = b$$', '$$a = b$$').

Unfortunately, because JavaScript overloads replace with both string and regular expression replacement, the replacement string was subject to the regular expression template format, where $is a special character and $$gets transformed to . This turned your block MathJax into inline MathJax. The fix was to escape the replacement string, converting each to$$ so it would escape, but since we're using replace to do that, it looks like '$$a = b$$'.replace('$', '').

Good joke on me. Evidently the bug only affects the editing preview. When the post is actually posted, it appears as expected. (If you click "edit" on my question and look at the preview, you'll see the problem I thought was present.)

Still would be nice to get fixed but hardly vital.