Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
13 lines (12 sloc) 532 Bytes
class MarkdownRenderer < Redcarpet::Render::HTML
def block_code(code, language)
formatter = Rouge::Formatters::HTML.new(wrap: false)
if language and language.include?('example')
lexer = Rouge::Lexer.find('html')
'<div class="example">' + code + '</div>' + '<div class="codeblock"><pre>' + formatter.format(lexer.lex(code)) + '</pre></div>'
else
lexer = Rouge::Lexer.find_fancy('guess', code)
'<div class="codeblock"><pre>' + formatter.format(lexer.lex(code)) + '</pre></div>'
end
end
end
You can’t perform that action at this time.