Textile & Markdown in Ruby
Thursday, 13 November 2008
Textile
Simple to implement with the redcloth gem
sudo gem install RedCloth
Usage,
require 'redcloth'
s = RedCloth.new "p. format this with textile"
puts s
Markdown
With markdown you've got three implementations to try,
- bluecloth gem (last maintained 2005, slow)
- rdiscount gem (better c implementation, fast!)
- maruku gem (pure ruby implementation)
To implement with BlueCloth
sudo gem install bluecloth
Then,
require 'bluecloth'
s = BlueCloth::new("# format this with markdown")
puts s
Or RDiscount
sudo gem install rdiscount
Then,
require 'rdiscount'
s = RDiscount.new("# format this with markdown")
puts s







We use rdiscount on our VoD website. It is extremely fast, and I guess some orders of magnitude faster than Bluecloth (untested). Do you know any easy way of adding custom tags for rdiscount to understand or do we have to roll our own additional parser for that purpose?
I just noticed that you are now running your own blog engine, I'll have a look at it. I like it very much, but the captcha is too hard to guess.
Best regards,
export RUBYOPT=rubygems
I'll look at adding custom tags to the base, shouldn't be too hard; either that or add a filter as you suggested.
All the best, have a great New Year.