Improve wiki rendering. Fix pygemnt + markdown invalid html

This commit is contained in:
Dmitriy Zaporozhets 2012-12-22 13:01:15 +02:00
parent ed35ea703c
commit cec866a7ce
2 changed files with 15 additions and 12 deletions

View file

@ -11,14 +11,13 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
def block_code(code, language)
options = { options: {encoding: 'utf-8'} }
options.merge!(lexer: language.downcase) if Pygments::Lexer.find(language)
h.content_tag :div, class: h.user_color_scheme_class do
if Pygments::Lexer.find(language)
Pygments.highlight(code, options.merge(lexer: language.downcase))
else
Pygments.highlight(code, options)
end.html_safe
end
<<-HTML
<div class="#{h.user_color_scheme_class}">
#{Pygments.highlight(code, options)}
</div>
HTML
end
def postprocess(full_document)