cmarkgfm icon indicating copy to clipboard operation
cmarkgfm copied to clipboard

Backslash removed when rendering multiline latex formula

Open tlunet opened this issue 7 months ago • 0 comments

Hi,

consider this markdown example

# Some equations

$$
\begin{array}{c|c}
\tau & Q \\ 
\hline
& w^\top
\end{array}
$$

then converting it like this :

html = cmarkgfm.github_flavored_markdown_to_html(readme, cmarkgfmOptions.CMARK_OPT_UNSAFE)

it removes one of the two backslashes used to indicate new line in the latex formula :

<h1>Some equations</h1>
<p>$$
\begin{array}{c|c}
\tau &amp; Q \
\hline
&amp; w^\top
\end{array}
$$</p>

which produces a Matjax error when rendering the equation using those scripts :

<script>
MathJax = {
    tex: {
    inlineMath: [['$', '$'], ['\\(', '\\)']]
    },
};
</script>
<script async
    src="https://cdn.jsdelivr.net/npm/[email protected]/es5/tex-svg.js"
    integrity="sha256-1CldwzdEg2k1wTmf7s5RWVd7NMXI/7nxxjJM2C4DqII="
    crossorigin="anonymous"
></script>

image

Is there any way to avoid that ?

tlunet avatar Jul 02 '24 22:07 tlunet