php-markdown icon indicating copy to clipboard operation
php-markdown copied to clipboard

markdown-extra emphasis and LaTeX syntax clashes

Open pkra opened this issue 11 years ago • 3 comments

Markdown+extra is already much better than regular markdown when it comes to interacting with LaTeX syntax (a la MathJax) but I'm wondering if anything can be done about the following.

While $$P_1, P_2$$ is not an issue, something like $(y_n)_{n\in \omega} $ some text $ (y_n)_{n\in \omega}$ triggers emphasis which for {n\in \omega}$ some text $(y_n) which in turn prevents MathJax from rendering the TeX code correctly.

I've tried to get a more minimal example and got as far as $)_{}$ some text $)_{}$, so this seems like a parantheses/braces issue. A workaround is to insert spaces after the _ but this is a bit unnatural for TeX.

Anyway, if anybody has any thoughts on this I'd appreciate it.

For reference, I was testing this with Mark Jaquith's markdown-on-save plugin on Wordpress.

pkra avatar May 10 '13 19:05 pkra

The only way to make this work reliably is to make PHP Markdown aware of the LaTeX syntax so it doesn't alter its content. I'm pretty sure emphasis is not the only thing that can go wrong here.

michelf avatar May 11 '13 10:05 michelf

Yes, I only have anecdotal evidence -- I've been using the combination of MathJax+phpmarkdown-extra for a few years on my research blog and that's pretty much the only thing that I found hard to work around.

Of course, it would be awesome to have math extension like pandoc-markdown.

pkra avatar May 11 '13 17:05 pkra

To be honest this is a Feature I don't need at all and I don't want my text trying to render it each request... So it has to be some kind of Plugin.

Why don't you extend the already rendered it code with your own syntax?

Take a look how I solved additional rendering on: https://git.typo3.org/TYPO3v4/Extensions/typo3wiki.git/blob/HEAD:/Classes/Helper/RenderHelper.php

Avalarion avatar May 11 '13 17:05 Avalarion