Class: Hologram::MarkdownRenderer

Inherits:
Redcarpet::Render::HTML
  • Object
show all
Defined in:
lib/hologram/markdown_renderer.rb

Direct Known Subclasses

HologramMarkdownRenderer

Instance Method Summary collapse

Instance Method Details

#block_code(code, language) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/hologram/markdown_renderer.rb', line 3

def block_code(code, language)
  if language and language.include?('example')
    if language.include?('js')
      # first actually insert the code in the docs so that it will run and make our example work.
      '<script>' + code + '</script>
      <div class="codeBlock jsExample">' + Pygments.highlight(code) + '</div>'
    else
      '<div class="codeExample">' + '<div class="exampleOutput">' + render_html(code, language) + '</div>' + '<div class="codeBlock">' + Pygments.highlight(code, :lexer => get_lexer(language)) + '</div>' + '</div>'
    end
  else
    '<div class="codeBlock">' + Pygments.highlight(code) + '</div>'
  end
end