Fork me on GitHub

digital:pardoe

My Little Piece Of The Internet

Textilize Alternative

The textilize methods in Rails has never really been what I wanted. When it wasn’t adding paragraphs it was messing with my line brakes but it made such a good job of making HTML and XHTML that validates. In order to make it work better I re-wrote the method to be more suitable.

Put the following in the ‘application_helper.rb’ file and call it using ‘custom_text(“String”)’.

Job done, you should get correct HTML and XHTML but no paragraphs and no messing with line breaks.

Tagged: Ruby on Rails, Tutorial
Published by digitalpardoe on Saturday 19 August 2006 at 11:15 PM