Better Textilize
Join the DZone community and get the full member experience.
Join For FreeA 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. :)
def textilize(text)
RedCloth.new(text.gsub(/, '<').gsub(/>/, '>')).to_html
end
Opinions expressed by DZone contributors are their own.
Comments