Skip to content
trans edited this page Oct 25, 2011 · 6 revisions

DESCRIPTION

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.

FEATURES

  • 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.

SYNOPSIS

Via the class.

  html = "<b>hello</b>"

  HtmlFilter.new(options).filter(html)

Or using the String extension.

  html.html_filter(options)  #=> "<b>hello</b>"
Clone this wiki locally