= RedCloth - Textile parser for Ruby
Homepage:: http://redcloth.org
Author:: Jason Garber
Copyright:: (c) 2008 Jason Garber
License:: MIT
(See http://redcloth.org/textile/ for a Textile reference.)
= RedCloth
RedCloth is a Ruby library for converting Textile into HTML.
== Installing
RedCloth can be installed via RubyGems:
gem install RedCloth
It will install the appropriate Ruby, JRuby, or Win32 gem. If using JRuby, version 1.1.5 or greater is required.
== Compiling
If you just want to use RedCloth, you do NOT need to build/compile it. It is compiled from C sources automatically when you install the gem on the ruby platform. Binary gems are provided for JRuby and Win32 platforms.
RedCloth can be compiled with rake compile. Ragel 6.3 or greater and the
echoe gem are needed to build, compile, and package RedCloth. Again, Ragel and echoe are NOT needed to simply use RedCloth.
You can cross-compile for JRuby with rake java compile and for Win32 with rake mingw compile.
== Using RedCloth
RedCloth is simply an extension of the String class, which can handle
Textile formatting. Use it like a String and output HTML with its
RedCloth#to_html method.
Simple use:
text = "This is *my* text."
RedCloth.new(text).to_html
Multi-line example:
doc = RedCloth.new <This is a link
== Images
To insert an image, put the URL for the image inside exclamation marks.
Optional: text that immediately follows the URL in (parentheses) will
be used as the Alt text for the image. Images on the web should always
have descriptive Alt text for the benefit of readers using non-graphical
browsers.
Optional: place a colon followed by a URL immediately after the
closing ! to make the image into a link.
Example:
!http://www.textism.com/common/textist.gif(Textist)!
Will become:
With a link:
!/common/textist.gif(Textist)!:http://textism.com
Will become:
== Defining Acronyms
HTML allows authors to define acronyms via the tag. The definition appears as a
tool tip when a cursor hovers over the acronym. A crucial aid to clear writing,
this should be used at least once for each acronym in documents where they appear.
To quickly define an acronym in Textile, place the full text in (parentheses)
immediately following the acronym.
Example:
ACLU(American Civil Liberties Union)
Will become:
ACLU
== Adding Tables
In Textile, simple tables can be added by separating each column by
a pipe.
|a|simple|table|row|
|And|Another|table|row|
Styles are applied with curly braces.
table{border:1px solid black}.
{background:#ddd;color:red}. |a|red|row|