Skip to content
Snippets Groups Projects
Commit 6a868a4c authored by Sid Sijbrandij's avatar Sid Sijbrandij Committed by Dmitriy Zaporozhets
Browse files

Fix pygment lexer 500 errors when an alias is used instead of a name.

parent 26ed59f1
No related branches found
No related tags found
2 merge requests!103705 2 stable,!4341Added wiki-page search for 5-2-stable, Fixed issue #4310
This commit is part of merge request !10370. Comments created here will be created in the context of that merge request.
Loading
@@ -11,7 +11,8 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
Loading
@@ -11,7 +11,8 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
   
def block_code(code, language) def block_code(code, language)
options = { options: {encoding: 'utf-8'} } options = { options: {encoding: 'utf-8'} }
options.merge!(lexer: language.downcase) if Pygments::Lexer.find(language) lexer = Pygments::Lexer.find(language) # language can be an alias
options.merge!(lexer: lexer.name.downcase) if lexer # downcase is required
   
# New lines are placed to fix an rendering issue # New lines are placed to fix an rendering issue
# with code wrapped inside <h1> tag for next case: # with code wrapped inside <h1> tag for next case:
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment