public Method

SanitizeHelper.strip_tags(html)

Strips all HTML tags from the html, including comments. This uses the html-scanner tokenizer and so its HTML parsing ability is limited by that of html-scanner.

Examples

strip_tags("Strip <i>these</i> tags!")
# => Strip these tags!

strip_tags("<b>Bold</b> no more!  <a href="more.html">See more here</a>...")
# => Bold no more!  See more here...

strip_tags("<div>Welcome to my website!</div>")
# => Welcome to my website!

Source Code

# File action_view/helpers/sanitize_helper.rb, line 74
def strip_tags(html)     
  self.class.full_sanitizer.sanitize(html)
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.