require 'rubygems' require 'sanitize' html = ARGF.read puts Sanitize.clean(html, :elements => ['a', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ul', 'li', 'table', 'tr', 'th', 'td'], :attributes => {'a' => ['href', 'title']})