Tags:Highlight: Decomposed HTMLLegacy formatter (#8623)

Merge pull request 8623
This commit is contained in:
Sampath Sukesh Ravolaparthi 2021-08-09 18:01:09 +05:30 committed by GitHub
parent ca2f106c8f
commit ddbc8263de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 7 deletions

View File

@ -80,13 +80,17 @@ module Jekyll
def render_rouge(code) def render_rouge(code)
require "rouge" require "rouge"
formatter = ::Rouge::Formatters::HTMLLegacy.new( formatter = ::Rouge::Formatters::HTML.new
:line_numbers => @highlight_options[:linenos], if @highlight_options[:linenos]
:wrap => false, formatter = ::Rouge::Formatters::HTMLTable.new(
formatter,
{
:css_class => "highlight", :css_class => "highlight",
:gutter_class => "gutter", :gutter_class => "gutter",
:code_class => "code" :code_class => "code",
}
) )
end
lexer = ::Rouge::Lexer.find_fancy(@lang, code) || Rouge::Lexers::PlainText lexer = ::Rouge::Lexer.find_fancy(@lang, code) || Rouge::Lexers::PlainText
formatter.format(lexer.lex(code)) formatter.format(lexer.lex(code))
end end