Commit ca54d43f9900666ff86fb4c647f9f9441eec781a
1 parent
6cec9ed3
Exists in
master
and in
4 other branches
Fix 500s because of "missing" lexer
Showing
1 changed file
with
4 additions
and
2 deletions
Show diff stats
lib/redcarpet/render/gitlab_html.rb
| ... | ... | @@ -10,10 +10,12 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML |
| 10 | 10 | end |
| 11 | 11 | |
| 12 | 12 | def block_code(code, language) |
| 13 | + options = { options: {encoding: 'utf-8'} } | |
| 14 | + | |
| 13 | 15 | if Pygments::Lexer.find(language) |
| 14 | - Pygments.highlight(code, lexer: language, options: {encoding: 'utf-8'}) | |
| 16 | + Pygments.highlight(code, options.merge(lexer: language.downcase)) | |
| 15 | 17 | else |
| 16 | - Pygments.highlight(code, options: {encoding: 'utf-8'}) | |
| 18 | + Pygments.highlight(code, options) | |
| 17 | 19 | end |
| 18 | 20 | end |
| 19 | 21 | ... | ... |