-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
"DollarMath" option to turn off markdown when using KaTex and MathJax DollarMath Quotes in markdown #693
Comments
Here's some code i was using to test your markdown engine in combination with mathjax:
|
See below, I can use showdown perfectly with mathjax by calling the javascript function below to encode all of the "mathjax dollar quotes" with base64, then to run showdown engine on this modified markdown, then to unencode the resulting html from mathjax to remove base64 encoding of the math expression.: that's an easy way to build "mathdollar" option into your markdown library... just base64 encode anything inbetween $ .. $ and $$ .. $$...and then base64 decode when you are done... its a little bit messy however, because i'm not 100% sure about the latex rules for preventing runaway uncloced math dollar quotes. but i think its something like this:
|
if you don't specifically need mathjax, you could use katex with the showdown-katex extension and won't have to wait for a change in showdown itself. katex does basically everything mathjax does but faster |
thanks. that's a good tip. |
Any chance you could add an option to turnoff markdown conversion between the tags:
$ ... $
and
This is required for markdown used in combination with mathjax or KaTex… such as on math.stackexchange.com... see markdown used on this website... or typera ...or markdown in Jupiter notebooks... the use of these DollarMath tags in markdown is fairly universal these days to delimit latex embedded in markdown...
I just noticed that when I convert markdown with embedded mathjax… some of the equations get messed up by markdown tags being converted inside of math equation fence characters of "$" and "$$"
would be nice to have this as an option. example:
one example was this:
This is the markdown of the mathjax before conversion to html by showdown:
<p>$$
\delta(n) = \begin{cases}
1 & n = 0 \\
0 & otherwise
\end{cases}
$$<\p>
after conversion it converts "&" into & amp; ... mathjax doesn't like this... and also the double underscore \\ is converted into a single underscore \...which blow up mathjax equation as well... example of bad convertion of mathjax into html by showdown:
<p>$$
\delta(n) = \begin{cases}
1 & amp; n = 0 \
0 & amp; otherwise
\end{cases}
$$</p>
When the above is rendered into mathjax it blows up the equation and doesn't work...
Another bug case was:
This had a problem, that thankful your underline option fixed it... but without underscore option set to true... the mathjax equation gets blowup with incorrect syntax as:
mathjax doesn't like underscores converted to <em> tag..
in short, its probably safer to turn off markup processing between "$" .. "$" and "$$" .. "$$" tags.... these are the tag markers that are universal used in markup to indicate that a latex math equation is contained within and that markdown conversion needs to be temporary turned off while inside of these tags... that's why I think you should add "mathjax" option to your tool to do this processing for people using your library.
however, you really shouldn't convert ampersands inside of these mathjax blocks into & amp; ... or double backslash \\ into signle backslash \... mathjax needs a raw ampersand and raw backslash... I would put that on your bug list... its quite common to use ampersands in mathjax script... you need a way to pass a raw ampersand though your script when its in the math fence block.
The text was updated successfully, but these errors were encountered: