class GhPreview::RedcarpetFilter

Public Class Methods

new(text, context = nil, result = nil) click to toggle source
Calls superclass method
# 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

Public Instance Methods

call() click to toggle source

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

# File lib/gh_preview/redcarpet_filter.rb, line 28
def call
  Redcarpet::Markdown.new(HTMLwithPygments, mk_options).render(@text)
end

Private Instance Methods

mk_options() click to toggle source
# File lib/gh_preview/redcarpet_filter.rb, line 36
def mk_options
  {
    strikethrough: true,
    autolink:      true,
    tables:        true,
    underline:     true,
    highlight:     true,
    lax_spacing:   true,
    fenced_code_blocks: true
  }
end