This Rails plugin provides some view helpers that enhance Textile support.
script/plugin install [email protected]:zeke/textile_helpers.git
As of Rails 2.3, You may also need to install the RedCloth gem..
sudo gem install redcloth
..and add this to environment.rb
config.gem "RedCloth"
The textilize_plus
helper method works just like Rails’ textilize method, but with a few goodies added. It cleans up MS Word characters; repairs (some) faulty markup, such as heading tags (h1, h2, etc) not having a newline underneath them; adds an id attribute to headings based on the content of the heading.
textilize_plus(my_string)
The table_of_contents_for
helper method is meant to be paired with textilize_plus. It parses your textilizable string and generate a hierarchical table of countents based on the h1, h2, and h3 headings.
<div id="main"> <%= textilize_plus(my_string) %> </div> <div id="sidebar"> <%= table_of_contents_for(my_string) %> </div>
See lib/textile_helpers.rb for more details.
Copyright © 2009 Zeke Sikelianos, released under the MIT license