Fix code blocks in Markdown not knowing about the user's color scheme

This commit is contained in:
Riyad Preukschas 2012-11-27 22:49:52 +01:00
parent 184a9ecaf6
commit d2767221a5

View file

@ -12,10 +12,12 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
def block_code(code, language) def block_code(code, language)
options = { options: {encoding: 'utf-8'} } options = { options: {encoding: 'utf-8'} }
h.content_tag :div, class: h.user_color_scheme_class do
if Pygments::Lexer.find(language) if Pygments::Lexer.find(language)
Pygments.highlight(code, options.merge(lexer: language.downcase)) Pygments.highlight(code, options.merge(lexer: language.downcase))
else else
Pygments.highlight(code, options) Pygments.highlight(code, options)
end.html_safe
end end
end end