# Sanitizing and stripping some html?

**URL:** <https://www.ruby-forum.com/t/sanitizing-and-stripping-some-html/92656>\
**Category:** Rails\
**Created:** [April 22, 2007, 5:33pm UTC](https://www.ruby-forum.com/t/sanitizing-and-stripping-some-html/92656 "2007-04-22T17:33:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomasmaas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/5e9695/32.png) [@thomasmaas](https://www.ruby-forum.com/u/thomasmaas)\
**Post date:** [April 22, 2007, 5:33pm UTC](https://www.ruby-forum.com/t/sanitizing-and-stripping-some-html/92656/1 "2007-04-22T17:33:19Z")

</div>

I have an application that manages a list of feeds. In a scheduled  
BackgrounDRb worker, I parse each of these feeds and post the content  
to the same site. Some of these feeds contain HTML in the description  
of each item in the feed. I would like to first sanitize the HTML to  
remove anything particularly harmful, then I would like to strip  
certain tags, leaving the content.

I first tested Rick O.'s white\_list plugin. It seems that this  
simply strips tags and their content. For example, if I say p is a bad  
tag,

content

 gets completely stripped. I would actually like to  
keep the ‘content’ and simply remove the HTML. Certain tags are  
alright, such as b, em, strong, but most I would like stripped out.

I then tested [Sanitize HTML in Ruby | Take the First Step](http://ideoplex.com/id/1138/sanitize-html-in-ruby) and it  
seems to do the trick. I was just wondering if anyone else had been  
interested in stripping HTML but leaving the content and how they went  
about doing so. Thanks for your input.
