Is there a markdown parser supported on Jekyll that plays nicely with mathjax?

本秂侑毒 提交于 2019-12-20 18:29:12

问题


I use a Jekyll based blog and need a markdown parser that won't clobber my Mathjax expressions (for instance, interpreting b_t - b_{t-1} as b<em>t - b</em> t - 1). Mathjax and markdown get along nicely over on math.stackechange.com and mathoverflow.net. Some parsers also need to double escape the begin/end equation symbols \\(, while it seems others do not.

Things that aren't quite solutions:

Redcarpet2 has an option for no_intra_emphasis, which avoids underscores between letters being clobbered, so b_t is okay, but it still clobbers b_{t-1}.

There's a Jekyll plugin that lets you use liquid syntax, like {% m}% to begin an equation, but this means the file is no longer written in pure markdown and thus not portable to other contexts.

So is there a different markdown interpreter I can drop into Jekyll and experience bliss? If not, what workarounds have others found?


回答1:


Markdown won't process anything in block-level HTML tag, so simply wrapping Mathjax syntax in <div> </div> protects the Mathjax syntax, regardless of the interpreter. This nicely avoids having to escape the commands that begin and end the Mathjax, such as \( (inline) and \[ (display). Thanks to @lsegal on Github for pointing this out to me.




回答2:


Yes there's and it's kramdown, I've gone through the process of configuring it and it's explained at my blog. I've also found you can get Redcarpet to accept inline math using the syntax \\( some math \\). It'll output \( math \)to MathJax. Anyway, I prefer kramdown as it states to support LaTeX.



来源:https://stackoverflow.com/questions/10438937/is-there-a-markdown-parser-supported-on-jekyll-that-plays-nicely-with-mathjax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!