Sha256: 07a576ead044e764d628f20a478f49b370fcb1da65ea290ad36573023fe00aeb
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true 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: # # <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' class HtmlToMarkdown ## # @param value [String] # @param env [Item::Context] def initialize(value, env) @sanitized_value = SanitizeHtml.new(value, env).get end ## # @return [String] formatted in Markdown def get ReverseMarkdown.convert(@sanitized_value) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
html2rss-0.11.0 | lib/html2rss/attribute_post_processors/html_to_markdown.rb |
html2rss-0.10.0 | lib/html2rss/attribute_post_processors/html_to_markdown.rb |