HtmlTerminator
Visits Active Record fields and terminates unsafe HTML.
Installation
Add this line to your application's Gemfile:
gem 'html_terminator'
And then execute:
$ bundle
Or install it yourself as:
$ gem install html_terminator
Usage
In your Rails models:
terminate_html :field1, :field2, :field3
Options
Out of the box, HTML Terminator will strip out ALL html. You can pass in specific elements you want to preserve like this:
terminate_html :field1, :elements => ["b", "i", "em"]
terminate_html :field2, :elements => ["br"]
terminate_html :field3, :elements => ["em"]
Learn more about configuration options Here
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
