Class: Html2rss::AttributePostProcessors::MarkdownToHtml
- Inherits:
-
Object
- Object
- Html2rss::AttributePostProcessors::MarkdownToHtml
- Defined in:
- lib/html2rss/attribute_post_processors/markdown_to_html.rb
Overview
Generates HTML from Markdown.
It’s particularly useful in conjunction with the Template post processor to generate a description from other selectors.
YAML usage example:
selectors:
description:
selector: section
post_process:
- name: template
string: |
# %s
Price: %s
methods:
- self
- price
- name: markdown_to_html
Would e.g. return:
<h1>Section</h1>
<p>Price: 12.34</p>
Instance Method Summary collapse
-
#get ⇒ String
Formatted in Markdown.
-
#initialize(value, env) ⇒ MarkdownToHtml
constructor
A new instance of MarkdownToHtml.
Constructor Details
#initialize(value, env) ⇒ MarkdownToHtml
Returns a new instance of MarkdownToHtml.
33 34 35 36 |
# File 'lib/html2rss/attribute_post_processors/markdown_to_html.rb', line 33 def initialize(value, env) @value = value @env = env end |
Instance Method Details
#get ⇒ String
Returns formatted in Markdown.
40 41 42 |
# File 'lib/html2rss/attribute_post_processors/markdown_to_html.rb', line 40 def get SanitizeHtml.new(Kramdown::Document.new(@value).to_html, @env).get end |