Module: PuppetForgeServer::Utils::MarkdownRenderer

Included in:
App::Frontend
Defined in:
lib/puppet_forge_server/utils/md_renderer.rb

Defined Under Namespace

Classes: CustomRenderer

Instance Method Summary collapse

Instance Method Details

#markdown(text) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/puppet_forge_server/utils/md_renderer.rb', line 30

def markdown(text)
  options = {
    filter_html:     true,
    with_toc_data:   true,
    hard_wrap:       true,
    prettify:        true
  }

  extensions = {
    autolink:           true,
    superscript:        true,
    disable_indented_code_blocks: false,
    fenced_code_blocks: true,
    strikethrough: true,
    quote: true,
    tables: true
  }

  renderer = CustomRenderer.new(options)
  markdown = Redcarpet::Markdown.new(renderer, extensions)
  markdown.render(text)
end