Hi,
On Wed, Sep 17, 2014 at 12:00 AM, Guy Rutenberg <guy...@gm...> wrote:
> I want to use python-markdown together with MathJax (similar to the way
> equations are implemented in StackExchange sites). In order to do so, I need
> to make the parser keep everything between $ (dollar) signs as is, ignoring
> backspaces and other special characters.
>
> Is there a simple way to do it?
In PyMarkups there is some code that works with MathJax:
https://github.com/mitya57/pymarkups/blob/master/markups/markdown.py#L90
https://github.com/mitya57/pymarkups/blob/master/markups/markdown.py#L148
You can reuse or copy that code.
Unlike the mathjax extension listed on the wiki page, my code converts
$...$ blocks to an actual <script> element itself, instead of relying
on MathJax's tex2jax extension to do that. This is a more safe way
(i.e. supports escaping), and it also supports other delimiters (like
\[...\], \(...\) and \begin{}...\end{}).
--
Dmitry Shachnev
|