[devdocsgjs/main: 1356/1867] Fix code blocks style and add syntax highlight
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 1356/1867] Fix code blocks style and add syntax highlight
- Date: Fri, 19 Nov 2021 23:47:54 +0000 (UTC)
commit 71d2b494856e8e3258f136dfae30b5cb2838fac1
Author: MasterEnoc <brianhernandez222 hotmail com>
Date: Tue Dec 8 12:04:56 2020 -0600
Fix code blocks style and add syntax highlight
lib/docs/filters/twig/clean_html.rb | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
---
diff --git a/lib/docs/filters/twig/clean_html.rb b/lib/docs/filters/twig/clean_html.rb
index 0669950f..3754e80a 100644
--- a/lib/docs/filters/twig/clean_html.rb
+++ b/lib/docs/filters/twig/clean_html.rb
@@ -2,7 +2,8 @@ module Docs
class Twig
class CleanHtmlFilter < Filter
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|
node.before(node.children).remove
@@ -33,7 +34,23 @@ module Docs
node['style'] = 'text-align: center'
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
+
end
end
end
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]