Class: HTMLPipeline::ConvertFilter::MarkdownFilter
- Inherits:
-
HTMLPipeline::ConvertFilter
- Object
- Filter
- HTMLPipeline::ConvertFilter
- HTMLPipeline::ConvertFilter::MarkdownFilter
- Defined in:
- lib/html_pipeline/convert_filter/markdown_filter.rb
Overview
HTML Filter that converts Markdown text into HTML.
Context options:
:markdown[:parse] => Commonmarker parse options
:markdown[:render] => Commonmarker render options
:markdown[:extensions] => Commonmarker extensions options
Instance Attribute Summary
Attributes inherited from HTMLPipeline::ConvertFilter
Attributes inherited from Filter
Instance Method Summary collapse
-
#call(text, context: @context) ⇒ Object
Convert Commonmark to HTML using the best available implementation.
-
#initialize(context: {}, result: {}) ⇒ MarkdownFilter
constructor
A new instance of MarkdownFilter.
Methods inherited from HTMLPipeline::ConvertFilter
Methods inherited from Filter
#base_url, call, #has_ancestor?, #needs, #validate
Constructor Details
#initialize(context: {}, result: {}) ⇒ MarkdownFilter
Returns a new instance of MarkdownFilter.
14 15 16 |
# File 'lib/html_pipeline/convert_filter/markdown_filter.rb', line 14 def initialize(context: {}, result: {}) super end |
Instance Method Details
#call(text, context: @context) ⇒ Object
Convert Commonmark to HTML using the best available implementation.
19 20 21 22 23 |
# File 'lib/html_pipeline/convert_filter/markdown_filter.rb', line 19 def call(text, context: @context) = context.fetch(:markdown, {}) plugins = .fetch(:plugins, {}) Commonmarker.to_html(text, options: , plugins: plugins).rstrip! end |