class Loofah::Scrubbers::Escape
=> “ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>”
Loofah.html5_fragment(unsafe_html).scrub!(:escape)
unsafe_html = “ohai! <div>div is safe</div> <foo>but foo is not</foo>”:escape
performs HTML entity escaping on the unknown/unsafe tags:
=== scrub!(:escape)
def initialize # rubocop:disable Lint/MissingSuper
def initialize # rubocop:disable Lint/MissingSuper @direction = :top_down end
def scrub(node)
def scrub(node) return CONTINUE if html5lib_sanitize(node) == CONTINUE node.add_next_sibling(Nokogiri::XML::Text.new(node.to_s, node.document)) node.remove STOP end