[devdocsgjs/main: 242/1867] Fix syntax highlighting in `pre` tags




commit 577b4a62d72c31915c27fbc42c67ae077bff64c5
Author: Szabolcs Légrádi <szabolcs legradi gmail com>
Date:   Mon Mar 26 10:59:56 2018 +0200

    Fix syntax highlighting in `pre` tags

 lib/docs/filters/wordpress/clean_html.rb | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/lib/docs/filters/wordpress/clean_html.rb b/lib/docs/filters/wordpress/clean_html.rb
index 91708045..42ca5f29 100644
--- a/lib/docs/filters/wordpress/clean_html.rb
+++ b/lib/docs/filters/wordpress/clean_html.rb
@@ -11,9 +11,14 @@ module Docs
             '.anchor', '.toc-jump', '.source-code-links', '.user-notes',
             '.show-more', '.hide-more').remove
 
-        # Add PHP code highlighting
         br = /<br\s?\/?>/i
-        css('.source-code-container', '.syntaxhighlighter').each do |node|
+
+        # Add PHP code highlighting
+        css('pre').each do |node|
+          node['data-language'] = 'php'
+        end
+
+        css('.source-code-container').each do |node|
           node.name = 'pre'
           node.inner_html = node.inner_html.gsub(br, "\n")
           node.content = node.content.strip


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]