Class: Redmine::WikiFormatting::CommonMark::MarkdownFilter
- Inherits:
-
HTML::Pipeline::TextFilter
- Object
- HTML::Pipeline::TextFilter
- Redmine::WikiFormatting::CommonMark::MarkdownFilter
- Defined in:
- lib/redmine/wiki_formatting/common_mark/markdown_filter.rb
Overview
Converts Markdown to HTML using CommonMarker
We do not use the stock HTML::Pipeline::MarkdownFilter because this does not allow for straightforward configuration of render and parsing options
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(text, context = nil, result = nil) ⇒ MarkdownFilter
constructor
A new instance of MarkdownFilter.
Constructor Details
#initialize(text, context = nil, result = nil) ⇒ MarkdownFilter
Returns a new instance of MarkdownFilter.
29 30 31 32 |
# File 'lib/redmine/wiki_formatting/common_mark/markdown_filter.rb', line 29 def initialize(text, context = nil, result = nil) super text, context, result @text = @text.delete "\r" end |
Instance Method Details
#call ⇒ Object
34 35 36 37 38 39 |
# File 'lib/redmine/wiki_formatting/common_mark/markdown_filter.rb', line 34 def call doc = CommonMarker.render_doc(@text, , extensions) html = doc.to_html , extensions html.rstrip! html end |