--- !ruby/object:RI::MethodDescription 
aliases: []

block_params: 
comment: 
- !ruby/struct:SM::Flow::P 
  body: "This <tt>sanitize</tt> helper will html encode all tags and strip all attributes that aren't specifically allowed. It also strips href/src tags with invalid protocols, like javascript: especially. It does its best to counter any tricks that hackers may use, like throwing in unicode/ascii/hex values to get past the javascript: filters. Check out the extensive test suite."
- !ruby/struct:SM::Flow::VERB 
  body: "  &lt;%= sanitize @article.body %&gt;\n"
- !ruby/struct:SM::Flow::P 
  body: "You can add or remove tags/attributes if you want to customize it a bit. See ActionView::Base for full docs on the available options. You can add tags/attributes for single uses of <tt>sanitize</tt> by passing either the <tt>:attributes</tt> or <tt>:tags</tt> options:"
- !ruby/struct:SM::Flow::P 
  body: Normal Use
- !ruby/struct:SM::Flow::VERB 
  body: "  &lt;%= sanitize @article.body %&gt;\n"
- !ruby/struct:SM::Flow::P 
  body: Custom Use (only the mentioned tags and attributes are allowed, nothing else)
- !ruby/struct:SM::Flow::VERB 
  body: "  &lt;%= sanitize @article.body, :tags =&gt; %w(table tr td), :attributes =&gt; %w(id class style)\n"
- !ruby/struct:SM::Flow::P 
  body: Add table tags to the default allowed tags
- !ruby/struct:SM::Flow::VERB 
  body: "  Rails::Initializer.run do |config|\n    config.action_view.sanitized_allowed_tags = 'table', 'tr', 'td'\n  end\n"
- !ruby/struct:SM::Flow::P 
  body: Remove tags to the default allowed tags
- !ruby/struct:SM::Flow::VERB 
  body: "  Rails::Initializer.run do |config|\n    config.after_initialize do\n      ActionView::Base.sanitized_allowed_tags.delete 'div'\n    end\n  end\n"
- !ruby/struct:SM::Flow::P 
  body: Change allowed default attributes
- !ruby/struct:SM::Flow::VERB 
  body: "  Rails::Initializer.run do |config|\n    config.action_view.sanitized_allowed_attributes = 'id', 'class', 'style'\n  end\n"
- !ruby/struct:SM::Flow::P 
  body: Please note that sanitizing user-provided text does not guarantee that the resulting markup is valid (conforming to a document type) or even well-formed. The output may still contain e.g. unescaped '&lt;', '&gt;', '&amp;' characters and confuse browsers.
full_name: ActionView::Helpers::SanitizeHelper#sanitize
is_singleton: false
name: sanitize
params: (html, options = {})
visibility: public
