Losing double backslashes, used with mathjax
sradc opened this issue · 1 comments
sradc commented
Hey, thanks for this library!
I've come accross an issue where double backslashes are lost. Losing the \\
is causing newlines to be lost in MathJax rendering.
Minimal example to recreate:
example.md
Example markdown
$$
y_k = [x_0, x_1,... x_{N-1}]
\begin{bmatrix}
\exp(0)\\
\exp(-i\frac{2 \pi k}{N})\\
\exp(-i\frac{2 \pi k}{N}2)\\
\exp(-i\frac{2 \pi k}{N}3)\\
\exp(-i\frac{2 \pi k}{N}4)\\
\vdots \\
\exp(-i\frac{2 \pi k}{N}(N-1))
\end{bmatrix}
$$
convert.py
import marko
from pathlib import Path
infile = Path("example.md")
out = Path("example.html")
out.write_text(marko.convert(infile.read_text()))
example.html
<p>$$
y_k = [x_0, x_1,... x_{N-1}]
\begin{bmatrix}
\exp(0)\
\exp(-i\frac{2 \pi k}{N})\
\exp(-i\frac{2 \pi k}{N}2)\
\exp(-i\frac{2 \pi k}{N}3)\
\exp(-i\frac{2 \pi k}{N}4)\
\vdots \
\exp(-i\frac{2 \pi k}{N}(N-1))
\end{bmatrix}
$$</p>
^- notice that there's now only single backslashes at the end of the lines.
Edit: Hmm, cmark does the same thing..
But I think the \\
notation works with GH pages. Not sure what I'm missing.
Edit: found pandoc
preserves the double backslashes.