提交 2ab782ae 编写于 作者: D Dmitriy Zaporozhets

Merge pull request #4260 from dosire/pygments-name

Fix pygment lexer 500 errors when an alias is used instead of a name.
......@@ -11,7 +11,8 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
def block_code(code, language)
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
# with code wrapped inside <h1> tag for next case:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册