Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Hendrik Mans http://www.mans.de

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Better textilize

A better textilize helper that doesn't use the :hard_breaks option of RedCloth, like Rails' built-in textilize does (for whatever reason). Also escapes any HTML entered by the user (instead of dismissing it, as RedCloth's :filter_html option would do).

This my not be what you need, but it's exactly what I need. :)

   1  
   2    def textilize(text)
   3      RedCloth.new(text.gsub(/</, '&lt;').gsub(/>/, '&gt;')).to_html
   4    end
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS