Class: CanRenderMarkdown::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/can_render_markdown/formatter.rb

Instance Method Summary collapse

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

#escapeObject



8
9
10
11
# File 'lib/can_render_markdown/formatter.rb', line 8

def escape
  @input = @view.send(:html_escape, @input)
  self
end

#to_htmlObject



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