I'm making a fairly basic rails app and I was wondering what's the best way to strip undesirable html from text field (basically, all I'm looking to preserve are links and no more than 2 linebreaks).
Currently, I'm stripping all html and using simpleformat, since it seems to be less overhead than using RDiscount and Markdown/Textile, but this is not really an ideal solution.
From stackoverflow
-
Probably the
sanitize
helper. -
Another option is Sanitize gem.
http://wonko.com/post/sanitize
Optimate : this seems like exactly what i was looking for, thanks.Ben : how is this different/better than the Rails built in sanitizer? http://api.rubyonrails.org/classes/HTML/Sanitizer.html
0 comments:
Post a Comment