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.