Module: ZenPush::Flavors::Github

Defined in:
lib/zenpush/flavors/github.rb

Class Method Summary collapse

Class Method Details

.optionize(options) ⇒ Object



36
37
38
# File 'lib/zenpush/flavors/github.rb', line 36

def self.optionize(options)
  options.each_with_object({}) { |option, memo| memo[option] = true }
end

.to_html(text) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/zenpush/flavors/github.rb', line 19

def self.to_html(text)
  renderer = SyntaxRenderer.new(optionize [
    :with_toc_data,
    :hard_wrap,
    :xhtml
  ])
  markdown = Redcarpet::Markdown.new(renderer, optionize([
    :fenced_code_blocks,
    :no_intra_emphasis,
    :tables,
    :autolink,
    :strikethrough,
    :space_after_headers
  ]))
  markdown.render(text)
end