Is HTML cleaner the equivalent of Ruby on Rails?

Has anyone come across the equivalent HTMLPurifier apps for Rails? Essentially, I need to clean up the often horribly generated HTML created by users before saving to the database.

http://htmlpurifier.org/

+6
source share
1 answer

You can use the sanitize method.

sanitize(html) 

There is also a Sanitize gem .

 Sanitize.clean(html) 

I prefer to use the Sanitize gem because it can be used as a before_save filter in your models, instead of using the sanitize method in each of your views.

+3
source

Source: https://habr.com/ru/post/890816/


All Articles