Commit 381638b7 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #4510 from Razer6/fix_not_found_lexers

Fix Pygments 500 error if lexer not found by name
parents 10491ce0 db325ef9
......@@ -12,7 +12,7 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
def block_code(code, language)
options = { options: {encoding: 'utf-8'} }
lexer = Pygments::Lexer.find(language) # language can be an alias
options.merge!(lexer: lexer.name.downcase) if lexer # downcase is required
options.merge!(lexer: lexer.aliases[0].downcase) if lexer # downcase is required
# New lines are placed to fix an rendering issue
# with code wrapped inside <h1> tag for next case:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment