_ _
r┐ ,r:ー'´.::.:: .:..`ヽ、
|i | f´.::.,__.:::::..::::::::::::::ヽ
|l | チr'´  ̄ ̄ヾ;::.:.|
,r1| キ| __ '´ __ l;::..l
|l || }撻鬱ij!'徼i匐}レ''1
|lr' i| f{`~゛ツ; ヾ~´ iノ}|
||l l| ぃ ´'_` Y´
||| l| ト、 ´ ̄ ` ,ィ{
||| i| | `ー-‐ ' }`iー -- 、
||| l| ,! i / ノ l _,シ ム
||| l| 〃ト、_,,,. ;i'メ |/ ,/ \
|! ∥ //lliiiiiiiiiiiiiiiill/{r―‐^ i〃/ ヽ
|l ∥ / ,イllliiiiiiiiiiiiillll/´ /r- ゝ ' l
|| ∥ / /´フliiiiiiiiiilllll/ , / |/ |
jlj l| / ir' |liiiiiiiilllllli' / | ーイ、
ム- 、| ハ |, /iiiiillllllllll| / | i
ノ `i / lj /llllllllllllllllll{/ l |
ヽ / l | /llllliillllllllllllll| | |
、r┤ ,ム、 | ヽ| /lliiiiiiiiiillllllllllll} | |
'{ヽ'r_'__ i 〉 l |iiiiiiiiiiiiiiilllllllllll| | 、 |
/〉ー-{ ソト 、 / ||iiiiiiiiiiiiiiiiiillllllll!、 | 二 |
しt_;ュ',// ヽ、 / | |iiiiiiiiiiiiiiiiiiiiillllllヽ、 | ` |
(_,イー' ´ | |iiiiiiiiiiiiiiiiiiiiiiiiiiiiiillヽ、 || ヽ |
└-、 ノ´ | |iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii| || |
Visits Active Record fields and terminates unsafe HTML.
Add this line to your application's Gemfile:
gem 'html_terminator'
And then execute:
$ bundle
Or install it yourself as:
$ gem install html_terminator
In your Rails models:
terminate_html :field1, :field2, :field3
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
- 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