Commit d2767221a5b566a7c476dba55d958d6062ea0733
1 parent
184a9eca
Exists in
master
and in
4 other branches
Fix code blocks in Markdown not knowing about the user's color scheme
Showing
1 changed file
with
6 additions
and
4 deletions
Show diff stats
lib/redcarpet/render/gitlab_html.rb
| ... | ... | @@ -12,10 +12,12 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML |
| 12 | 12 | def block_code(code, language) |
| 13 | 13 | options = { options: {encoding: 'utf-8'} } |
| 14 | 14 | |
| 15 | - if Pygments::Lexer.find(language) | |
| 16 | - Pygments.highlight(code, options.merge(lexer: language.downcase)) | |
| 17 | - else | |
| 18 | - Pygments.highlight(code, options) | |
| 15 | + h.content_tag :div, class: h.user_color_scheme_class do | |
| 16 | + if Pygments::Lexer.find(language) | |
| 17 | + Pygments.highlight(code, options.merge(lexer: language.downcase)) | |
| 18 | + else | |
| 19 | + Pygments.highlight(code, options) | |
| 20 | + end.html_safe | |
| 19 | 21 | end |
| 20 | 22 | end |
| 21 | 23 | ... | ... |