davidfstr/rdiscount

automatically replaces x^2 with x<sup>2</sup> which interrupts the MathJax rendering.

soulmachine opened this issue · 4 comments

rdiscount automatically replaces x^2 with x<sup>2</sup> which interrupts the MathJax rendering.

source: http://christopherpoole.github.io/using-mathjax-on-github-pages/

This superscripting behavior is expected in the default configuration.

If you want to escape that particular ^ so that it isn't interpreted as a superscript request you can prefix it with \. In other words, use x\^2.

If you want to disable superscripting globally (along with other emphasis processing), you can add the following to your _config.yml:

markdown: rdiscount
rdiscount:
  extensions:
    - strict

your first metod doesn't work. I used x\^2, as follows:

$$x\^2$$

then generated html code is :

$$x\<sup>2$$</sup>

which is not a illegal latex equation, the mathjax couldn't render it.

Works for me:

1.9.3p362 :003 > require 'rdiscount'
 => true 
1.9.3p362 :004 > RDiscount.new('$$x\^2$$').to_html
 => "<p>$$x^2$$</p>\n" 
1.9.3p362 :006 > RDiscount::VERSION
 => "2.0.7" 

What version of RDiscount are you using?

If you are using OS X or Linux, you can find out using:

gem specification rdiscount | grep version | head -n 2

Closing as ReporterAbandoned.