hakimel / reveal.js

The HTML Presentation Framework
https://revealjs.com
MIT License
67.59k stars 16.63k forks source link

markdown.js conflict with and mathjax when trying to interprete underscore. #2299

Open doosik71 opened 5 years ago

doosik71 commented 5 years ago

Mathjax plugin uses underscore to subscript string.

$$an = a{n-2} + a_{n-1}$$

But above Fibonacci formula does not correctly rendered as expected because markdown.js interpretes a pair of underscores as italic escape sequences before allowing them to be handled by mathjax plugin.

$$a\_n = a\_{n-2} + a\_{n-1}$$

Escaping all underscore with backslash as above does not solve this problem consistently because single underscore does not handled by markdown.js and is sent to mathjax which causes unintended results as below.

$$a\_n$$

If mathjax plugin is active, it would preferable any markdown special characters, including underscore character, between $$ not being handled by markdown.js ahead.

Thanks for your consideration.

ndaman commented 5 years ago

You can solve this easily by placing the entire equation inside back ticks

doosik71 commented 5 years ago

Thanks for your answer. I learned that backtick is better then backslash. But other tools like pandoc, gitbook, visual studio code don't allow to use backticks. I have to maintain two different version. One for Reveal with backticks and the other for pandoc/gitbook/vscode without backtics. This is somewhat cumbersome. I wish markdown.js can handle math expression without backticks someday.