class Html2rss::AttributePostProcessors::HtmlToMarkdown

Returns HTML code as Markdown formatted String. Before converting to markdown, the HTML is sanitized with SanitizeHtml. Imagine this HTML structure:

<section>
  Lorem <b>ipsum</b> dolor...
  <iframe src="https://evil.corp/miner"></iframe>
  <script>alert();</script>
</section>

YAML usage example:

selectors:
  description:
    selector: section
    extractor: html
    post_process:
      name: html_to_markdown

Would return:

'Lorem **ipsum** dolor'

Public Class Methods

new(value, env) click to toggle source
# File lib/html2rss/attribute_post_processors/html_to_markdown.rb, line 28
def initialize(value, env)
  @value = SanitizeHtml.new(value, env).get
end

Public Instance Methods

get() click to toggle source

@return [String] formatted in Markdown

# File lib/html2rss/attribute_post_processors/html_to_markdown.rb, line 34
def get
  ReverseMarkdown.convert @value
end