Class: CanRenderMarkdown::Formatter
- Inherits:
-
Object
- Object
- CanRenderMarkdown::Formatter
- Defined in:
- lib/can_render_markdown/formatter.rb
Instance Method Summary collapse
- #escape ⇒ Object
-
#initialize(input, view) ⇒ Formatter
constructor
A new instance of Formatter.
- #to_html ⇒ Object
Constructor Details
#initialize(input, view) ⇒ Formatter
Returns a new instance of Formatter.
3 4 5 6 |
# File 'lib/can_render_markdown/formatter.rb', line 3 def initialize(input, view) @input = input @view = view end |
Instance Method Details
#escape ⇒ Object
8 9 10 11 |
# File 'lib/can_render_markdown/formatter.rb', line 8 def escape @input = @view.send(:html_escape, @input) self end |
#to_html ⇒ Object
13 14 15 16 |
# File 'lib/can_render_markdown/formatter.rb', line 13 def to_html output = kramdown_document.to_html output.respond_to?(:html_safe) ? output.html_safe : output end |