: NotesAboutRedClothAndRails

Welcome :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register

Using Textile with Rails


You may find problems using the Rails 'textilize' methods if you are using Rails 1.2.3 and below with RedCloth 3.0.4 and above. Ruby on Rails was designed for 3.0.3, and when you upgrade RedCloth to 3.0.4, the 'textilize' methods malfunction.

For example, inputting this:

textilize("h1. This is a test of textile\n\nParagraph\n\nAnother paragraph\n\n* Bullets")


might produce this:

<h1>This is a test of textile<br />
Paragraph<br />
Another paragraph<br />
<ul>
<li>Bullets</li>
</ul></h1>


To fix this, you can do many things, listed here. The way I did it was to add this code to my Application Helper:

def textilize(text)
  RedCloth.new(text).to_html
end

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.2
Page was generated in 0.2317 seconds