From d2767221a5b566a7c476dba55d958d6062ea0733 Mon Sep 17 00:00:00 2001 From: Riyad Preukschas Date: Tue, 27 Nov 2012 22:49:52 +0100 Subject: [PATCH] Fix code blocks in Markdown not knowing about the user's color scheme --- lib/redcarpet/render/gitlab_html.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/redcarpet/render/gitlab_html.rb b/lib/redcarpet/render/gitlab_html.rb index 48b4da9d..bd590f92 100644 --- a/lib/redcarpet/render/gitlab_html.rb +++ b/lib/redcarpet/render/gitlab_html.rb @@ -12,10 +12,12 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML def block_code(code, language) options = { options: {encoding: 'utf-8'} } - if Pygments::Lexer.find(language) - Pygments.highlight(code, options.merge(lexer: language.downcase)) - else - Pygments.highlight(code, options) + 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 end