-
Notifications
You must be signed in to change notification settings - Fork 5
Home
trans edited this page Oct 25, 2011
·
6 revisions
HTML Filter library can be used to sanitize and sterilize HTML. A good idea if you let users submit HTML in comments, for instance.
This library also include CssFilter. The CssFilter class will clean-up a cascading style sheet. It can be used to remove whitespace and most importantly remove urls.
- Based on well-worn PHP library.
- Regular expression based filtering.
- Very efficient for small snippets, like blog comments.
- Pure-Ruby and no dependencies.
- Also has library to clean and compact cascading stylesheets.
Via the class.
html = "<b>hello</b>" HtmlFilter.new(options).filter(html)
Or using the String extension.
html.html_filter(options) #=> "<b>hello</b>"