As of version 3, Rails doesn't have the
markdown helper methods. Formatize brings
them back. Drop it into the old application you're upgrading and it'll smoothen
the process just that little bit more.
gem 'formatize' into your Gemfile and do a
bundle install, and that's
it. Formatize depends on
bluecloth so you will not have to
worry about those.
textilize_without_paragraph helper methods
textilize helper method accepts a string of
Textile and one or more options. In most cases
the default behavior will be suitable and you will not have to pass it any options:
textilize("*This is Textile!* Rejoice!") # => "<p><strong>This is Textile!</strong> Rejoice!</p>"
Sometimes, however, you want to customize how RedCloth parses your Textile. You can specify a single option:
textilize("This is worded <strong>strongly</strong>", :filter_html) # => "<p>This is worded <strong>strongly</strong></p>"
Or you can specify multiple options:
textilize("This is worded <strong>strongly</strong>", :filter_html, :lite_mode) # => "This is worded <strong>strongly</strong>"
textilize_without_paragraph works similarly except it omits the
<p> tag. Check out the
for an overview on the options available.
markdown helper method
markdown helper method accepts a string of
markdown("We are using __Markdown__ now!") # => "<p>We are using <strong>Markdown</strong> now!</p>"
If you set the
:safe option to
true the input string will be not sanitized
markdown("<em>We are using __Markdown__ now!</em>", :safe => true) # => "<p><em>We are using <strong>Markdown</strong> now!</em></p>"
Feel free to try other versions. Minor patches to support other versions are welcome.
Latest versions in the 1.8 and 1.9 series. Generally, Formatize will not jump through hoops to support other versions. 1.8 support may be dropped eventually.
The latest versions in all the 3.0 series. This is likely to change when 4.0 is released.
Copyright & Licensing
Copyright (c) 2012 David Trasbo
Released under the MIT License. See LICENSE for details.