Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Losing double backslashes, used with mathjax #116

Open
sradc opened this issue Jul 29, 2022 · 0 comments
Open

Losing double backslashes, used with mathjax #116

sradc opened this issue Jul 29, 2022 · 0 comments

Comments

@sradc
Copy link

sradc commented Jul 29, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant