vue~2: fix code blocks

Fixes #1884.
pull/1923/head
Simon Legner 2 years ago
parent 5c6d93f61b
commit b151ab59d0

@ -23,12 +23,23 @@ module Docs
# Remove code highlighting
css('.line-numbers-wrapper').remove
css('pre').each do |node|
node.parent.name = 'pre'
node.parent['data-language'] = node.parent['class'][/language-(\w+)/, 1]
node.parent['data-language'] = 'javascript' if node.parent['data-language'][/vue/] # unsupported by prism.js
node.parent.remove_attribute 'class'
node.parent.content = node.content.strip
if version == '3'
css('pre').each do |node|
node.parent.name = 'pre'
node.parent['data-language'] = node.parent['class'][/language-(\w+)/, 1]
node.parent['data-language'] = 'javascript' if node.parent['data-language'][/vue/] # unsupported by prism.js
node.parent.remove_attribute 'class'
node.parent.content = node.content.strip
end
else
css('pre').each do |node|
parent = node.ancestors('figure')[0]
parent.name = 'pre'
parent['data-language'] = parent['class'][/(html|js)/, 1]
parent.remove_attribute 'class'
node.css('br').each{ |br| br.replace "\n" }
parent.content = node.content.strip
end
end
css('.vue-mastery-link').remove

Loading…
Cancel
Save