Allow escaped characters to be used inside markdown math
When using the new dollar math syntax added in [markdown] Use `$...$` and `$$...$$` for math f... (#21757 - closed), using escaped characters such as \&
, \$
, or \\
inside the math generates an error.
For example, $20+30\$$
should be valid math, however it doesn't get recognized as math.
Detection is complicated by how we must handle escaping of characters in order to allow bypassing of our own references, see https://digitalmoksha@gitlab.com/gitlab-org/gitlab/blob/master/lib/banzai/filter/markdown_pre_escape_filter.rb
The symbols that we need worry about are listed in https://artofproblemsolving.com/wiki/index.php/LaTeX:Symbols#Command_Symbols (though I don't know if it's exhaustive or not).
In addition, \\
, which is an end of line indicator in Latex, is having the same problems.
From the original description in #375476 (closed) and reported by @q_wertz
The following code works
```math
\begin{align*}
\Delta t &= \frac{d(b_i, a_i)}{c} + \Delta t_{b_i} + \Delta t_{add} \\
&\approx
\end{align*}
```
This one does not work
```math
\begin{align*}
\Delta t &= \frac{d(b_i, a_i)}{c} + \Delta t_{b_i} + \Delta t_{add} \\
&\approx
\end{align*}
Result:
![image](/uploads/800b0b72e6a55f474e4c8f839394ad81/image.png)