Remove redundant class removal from code samples

pull/1711/head
IgnusG 3 years ago
parent 7efdd2dbf0
commit 0488073d3c

@ -51,28 +51,23 @@ module Docs
node.remove
end
# Properly format code examples
css('code.language-html').each do |node|
node.name = 'pre';
node['data-language'] = 'html'
node.parent.name = 'div';
node.parent['class'] = node.parent['class'].gsub(/bg-.*?\b/, ' ');
node.parent.parent['class'] = node.parent.parent['class'].gsub(/bg-.*?\b/, ' ');
end
css('code.language-diff').each do |node|
node.name = 'pre';
node['data-language'] = 'diff'
node.parent.name = 'div';
node.parent['class'] = node.parent['class'].gsub(/bg-.*?\b/, ' ');
node.parent.parent['class'] = node.parent.parent['class'].gsub(/bg-.*?\b/, ' ');
end
css('code.language-js').each do |node|
node.name = 'pre';
node['data-language'] = 'js'
node.parent.name = 'div';
node.parent['class'] = node.parent['class'].gsub(/bg-.*?\b/, ' ');
node.parent.parent['class'] = node.parent.parent['class'].gsub(/bg-.*?\b/, ' ');
end
@doc.traverse { |node| cleanup_tailwind_classes(node) }

Loading…
Cancel
Save