waylonflinn / markdown-it-katex

Add Math to your Markdown with a KaTeX plugin for Markdown-it
MIT License
256 stars 155 forks source link

Mathjax support with parsed markdown fails #18

Open auser opened 6 years ago

auser commented 6 years ago

Hi markdown-it team,

I should note at the offset that markdown-it + markdown-it-katex plugin parses most equations properly, except when there is markdown syntax in the equation.

Currently, I have a markdown document with a latex formula that looks like this:

\begin{equation}c_i = \begin{cases}
- \log{(\hat{y}_i)} & \text{for }y_i = 1 \\
- \log{(1 - \hat{y}_i)} & \text{for }y_i = 0
\end{cases}\end{equation}

Notice the - in the equation. Markdown-it sees these - marks and parses them as li elements which breaks the latex rendering (as latex doesn't know what to do with <ul><li>. Is there a way to tell markdown-it to skip rendering anything inside of the \begin{equation} and \end{equation} syntax? Alternative suggestions work too... I'm kind of stuck on this issue.

Thanks!

MakerGYT commented 4 years ago

markdown-it-latex2img

zackw commented 1 year ago

This appears to be fixed if markdown-it-katex is used with a sufficiently new core markdown-it.