diff --git a/lib/docs/filters/node/clean_html.rb b/lib/docs/filters/node/clean_html.rb index 6c95139b..97b32fef 100644 --- a/lib/docs/filters/node/clean_html.rb +++ b/lib/docs/filters/node/clean_html.rb @@ -4,6 +4,24 @@ module Docs def call css('hr').remove + css('pre').each do |node| + next unless (node.css('code').to_a.length > 1) + + node.css('code').each do |subnode| + + if subnode.classes.include?('mjs') + node.before('
MJS modules
') + elsif subnode.classes.include?('cjs') + node.before('CJS modules
') + end + + node.before(subnode) + subnode.wrap('') + end + + node.remove + end + # Remove "#" links css('.mark').each do |node| node.parent.parent['id'] = node['id'] @@ -17,9 +35,7 @@ module Docs css('pre').each do |node| next unless node.at_css('code') - if lang = node.at_css('code')['class'] - node['data-language'] = lang.remove(%r{lang(uage)?-}) - end + node['data-language'] = 'js' node.content = node.content end diff --git a/lib/docs/scrapers/node.rb b/lib/docs/scrapers/node.rb index a39da5ad..815d61f7 100644 --- a/lib/docs/scrapers/node.rb +++ b/lib/docs/scrapers/node.rb @@ -24,7 +24,7 @@ module Docs HTML version do - self.release = '16.1.0' + self.release = '16.2.0' self.base_url = 'https://nodejs.org/api/' end