austgl / python-markdown2

Automatically exported from code.google.com/p/python-markdown2
Other
0 stars 0 forks source link

how to make markdown latex-friendly? #45

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi I would like to be able to completely escape from markdown processing 
between $ ... $  and $$ ... $$ to contain latex - to be rendered with MathJax.

So far enabling code-friendly extra helped, but I bet there are cases where 
markdown will still mangle latex. Is there a solution for that?

Thanks.

Original issue reported on code.google.com by evgeny.f...@gmail.com on 30 Aug 2010 at 10:57

GoogleCodeExporter commented 9 years ago
@evgeny: Probably the best first step would be to give some concrete examples. 
Ideally a patch that added input/output test cases would be great. Given that I 
think it would be clear whether this would be a simple patch.

Original comment by tre...@gmail.com on 31 Aug 2010 at 5:02

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I haven't done any testing with this other than "hey, this seems to work," but 
I hacked this together to make markdown2 work with MathJax on my blog. The 
basic idea is to just find portions of the code wrapped in \( \) or \[ \] and 
escape everything. I don't like using $ and $$ personally, but it should be 
easy to tweak the code to allow using those as MathJax delimiters. Of course 
you need to include and configure MathJax separately on your HTML page, but 
this patch works for me using the MathJax "tex2jax" preprocessor.

Original comment by hamann.n...@gmail.com on 22 Feb 2011 at 10:05

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Here's my stab at it. I stuck with $ and $$ over \( and \[, but I all you would 
have to do here is modify my _equation_re regexp. $ and $$ is nice because it 
makes the regexp simpler but a few "|" alternatives would do the job. And 
Evgeny, if you get this, I'm using this in askbot, and it works fine. The 
Javascript needs some updating to match this output, but I've already made 
progress there, too.

Original comment by m...@cvxr.com on 1 Sep 2012 at 3:12

Attachments: