require 'reverse_markdown'
module Html2rss
module AttributePostProcessors
##
# Returns HTML code as Markdown formatted String.
# Before converting to markdown, the HTML is sanitized with SanitizeHtml.
# Imagine this HTML structure:
#
#
# Lorem ipsum dolor...
#
#
#
#
# YAML usage example:
#
# selectors:
# description:
# selector: section
# extractor: html
# post_process:
# name: html_to_markdown
#
# Would return:
# 'Lorem **ipsum** dolor'
class HtmlToMarkdown
def initialize(value, env)
@value = SanitizeHtml.new(value, env).get
end
##
# @return [String] formatted in Markdown
def get
ReverseMarkdown.convert @value
end
end
end
end