Skip to content

Commit 577b4a6

Browse files
committed
Fix syntax highlighting in pre tags
1 parent fde4521 commit 577b4a6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/docs/filters/wordpress/clean_html.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@ def call
1111
'.anchor', '.toc-jump', '.source-code-links', '.user-notes',
1212
'.show-more', '.hide-more').remove
1313

14-
# Add PHP code highlighting
1514
br = /<br\s?\/?>/i
16-
css('.source-code-container', '.syntaxhighlighter').each do |node|
15+
16+
# Add PHP code highlighting
17+
css('pre').each do |node|
18+
node['data-language'] = 'php'
19+
end
20+
21+
css('.source-code-container').each do |node|
1722
node.name = 'pre'
1823
node.inner_html = node.inner_html.gsub(br, "\n")
1924
node.content = node.content.strip

0 commit comments

Comments
 (0)