Class: MarkDon::Converter
- Inherits:
-
Object
- Object
- MarkDon::Converter
- Defined in:
- lib/mark_don/converter.rb
Constant Summary collapse
- STRIP_TAGS =
%w[script style meta link].freeze
Class Method Summary collapse
Class Method Details
.convert(html) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/mark_don/converter.rb', line 8 def self.convert(html) doc = Nokogiri::HTML(html) STRIP_TAGS.each { |tag| doc.css(tag).remove } body = doc.at('body') || doc ReverseMarkdown.convert(body.inner_html, unknown_tags: :bypass, github_flavored: true).strip end |