| ... | @@ -11,14 +11,13 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML |
... | @@ -11,14 +11,13 @@ 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)
|
|
|
|
|
|
|
|
h.content_tag :div, class: h.user_color_scheme_class do
|
|
<<-HTML
|
|
|
if Pygments::Lexer.find(language)
|
|
<div class="#{h.user_color_scheme_class}">
|
|
|
Pygments.highlight(code, options.merge(lexer: language.downcase))
|
|
#{Pygments.highlight(code, options)}
|
|
|
else
|
|
</div>
|
|
|
Pygments.highlight(code, options)
|
|
HTML
|
|
|
end.html_safe
|
|
|
|
|
end
|
|
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def postprocess(full_document)
|
|
def postprocess(full_document)
|
| ... | |
... | |
| ... | | ... | |