Class: GhPreview::RedcarpetFilter

Inherits:
HTML::Pipeline::TextFilter
  • Object
show all
Defined in:
lib/gh_preview/redcarpet_filter.rb

Instance Method Summary collapse

Constructor Details

#initialize(text, context = nil, result = nil) ⇒ RedcarpetFilter

Returns a new instance of RedcarpetFilter.



19
20
21
22
# File 'lib/gh_preview/redcarpet_filter.rb', line 19

def initialize(text, context = nil, result = nil)
  super text, context, result
  @text = @text.gsub "\r", ''
end

Instance Method Details

#callObject

Convert Markdown to HTML using the best available implementation and convert into a DocumentFragment.



28
29
30
# File 'lib/gh_preview/redcarpet_filter.rb', line 28

def call
  Redcarpet::Markdown.new(HTMLwithPygments, mk_options).render(@text)
end