Upgrade to SuperRedCloth
February 22nd, 2008
by David South Jr
RedCloth doesn’t properly parse correctly. A big problem is the way it handles dashes. A double dash -- is supposed to be converted to an em dash. However, if you use two double dashes in a sentence -- like how Freda commonly does and like I am doing now -- it converts them into a strike. Yuck. Strike is so rarely used. This - is how it looks - with two double hyphens.
Apparently there is a new SuperRedCloth by Why the Lucky Stiff.
You need to install ragel.
On the Mac with darwin ports:
$ sudo port install ragel
On Ubuntu/Debian:
$ sudo aptitude install ragel
To install the redcloth gem:
$ sudo gem install superredcloth --source http://code.whytheluckystiff.net
SuperRedCloth is under active development so it pays to keep the gem up-to-date. According to the SuperRedCloth Wiki, the gem is always a few days behind. So compiling from source may be useful:
$ svn co http://code.whytheluckystiff.net/svn/redcloth/branches/superredcloth superredcloth
$ cd superredcloth
$ rake
$ rake gem
$ gem install pkg/superredcloth-1.###.gem
Rails assumes that you are using RedCloth when you run the textilize command. So you need to load this code into helpers/application_helper.rb:
def textilize(text)
require_library_or_gem "superredcloth" unless Object.const_defined?(:SuperRedCloth)
if text.blank?
""
else
textilized = SuperRedCloth.new(text)
textilized.to_html
end
end
It works.
Sorry, comments are closed for this article.