RedCloth是一个令你可以在Ruby中使用Textile的模块。Textile是一个文本格式,一个非常简单的文本格式。可以将一个可读的文本转成HTML。
1.安装
$ gem install RedCloth
NB: The RedCloth gem name is CamelCase, not lowercase. If you mistakenly do a gem install redcloth
, you’ll get ERROR: could not find redcloth locally or in a repository
.
2源码安装:
$ git clone git://github.com/jgarber/redcloth.git
$ cd redcloth
$ rake install
You’ll need echoe and Ragel to compile it.
3.使用redcloth
RedCloth.new("Some text").to_html
#=> "<p>Some text</p>"
See the Official Textile Reference Manual for RedCloth 4 for help with Textile formatting