diff --git a/lib/redcarpet/render/gitlab_html.rb b/lib/redcarpet/render/gitlab_html.rb index 30a80714..48b4da9d 100644 --- a/lib/redcarpet/render/gitlab_html.rb +++ b/lib/redcarpet/render/gitlab_html.rb @@ -10,10 +10,12 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML end def block_code(code, language) + options = { options: {encoding: 'utf-8'} } + if Pygments::Lexer.find(language) - Pygments.highlight(code, lexer: language, options: {encoding: 'utf-8'}) + Pygments.highlight(code, options.merge(lexer: language.downcase)) else - Pygments.highlight(code, options: {encoding: 'utf-8'}) + Pygments.highlight(code, options) end end