note: if you're using Radiant 0.7.0 or newer all you need to do is install the RDiscount gem and you'll get the better parser without needing to install this extension. users of the 0.6.x series may still find this extension helpful.
You need to have the
rdiscount gem (version 1.2.6+) installed.
gem install rdiscount
More important than the speed gain in RDiscount is the level of conversion accuracy, for example compare the very last test, my un-official and admittedly narrow "bold two digit number test". Nowhere in that span of numbers should you see an actual *. If you're never doing any Markdown that confuses BlueCloth and just care about rendering big spans of Markdown you'll have to install it for yourself and see how much faster it really is. One thing is definite, it is faster; which becomes more apparent the larger the span of Markdown you have to convert. Just to give you some idea, I consistently see results of 4 seconds (BlueCloth) vs. 1 second (RDiscount) to render the entire demo page.
You can either
git clone from github or download and unpack a taball into a
vendor/extensions/markdown_filter directory, then restart your server. There are no
rake tasks to run.
If you don't see the (RDiscount) label at the end of the extension description in the Extensions tab you're most likely running 0.6.7 or lower. In those versions of Radiant, the default extensions are loaded before custom ones with the same name; you'll need to make a trivial change to the
initializer.rb file in
# change line 24 from paths = [RADIANT_ROOT + '/vendor/extensions', RAILS_ROOT + '/vendor/extensions'].uniq # to paths = [RAILS_ROOT + '/vendor/extensions', RADIANT_ROOT + '/vendor/extensions'].uniq
You'll need to restart your server again, but after that you should see the (RDiscount) label in the Extensions tab.
I needed an implementation of Markdown that followed the full syntax, and did so consistently. For example, in BlueCloth
**1%** yields the HTML
<em>*1%*</em> however, in RDiscount it correctly yields
<strong>1%</strong>. Eventually you get tired of explaining to clients that even though they typed it in exactly right the content management system you provided them doesn't understand it, and instead they need to type out the actual HTML.
RDiscount brings Discount Markdown's C implementation of SmartyPants built in so there is no need to rely on RubyPants which like BlueCloth is dead slow compared to a C implementation. Installing it will automatically override the built-in (BlueCloth) Markdown so you don't need to change the filter on your pages. You can tell the extension is properly installed when you see (RDiscount) at the end of the extension description in the Extensions tab of the admin interface.