Fix code blocks style and add syntax highlight

pull/1403/head
MasterEnoc 4 years ago
parent 978f3e891d
commit 71d2b49485

@ -2,7 +2,8 @@ module Docs
class Twig class Twig
class CleanHtmlFilter < Filter class CleanHtmlFilter < Filter
def call def call
css('.infobar', '.offline-docs', '.headerlink').remove
css('.infobar', '.offline-docs', '.headerlink', '.linenos').remove
css('.builtin-reference', '.admonition-wrapper', 'h1 > code', 'h2 > code', '.body-web', '.reference em').each do |node| css('.builtin-reference', '.admonition-wrapper', 'h1 > code', 'h2 > code', '.body-web', '.reference em').each do |node|
node.before(node.children).remove node.before(node.children).remove
@ -33,7 +34,23 @@ module Docs
node['style'] = 'text-align: center' node['style'] = 'text-align: center'
end end
# syntax highlight
css('.highlight').each do |node|
node.css('pre').each do |subnode|
subnode['data-language'] = 'php'
subnode.add_class('highlight')
end
end
# fix code blocks style
css('.highlighttable').each do |node|
code = node.at_css('pre')
node.before(code)
node.remove
end
doc doc
end end
end end
end end

Loading…
Cancel
Save