diff --git a/lib/docs/filters/yarn/clean_html_berry.rb b/lib/docs/filters/yarn/clean_html_berry.rb index 00e0316c..5d901150 100644 --- a/lib/docs/filters/yarn/clean_html_berry.rb +++ b/lib/docs/filters/yarn/clean_html_berry.rb @@ -2,21 +2,40 @@ module Docs class Yarn class CleanHtmlBerryFilter < Filter def call - # Version notice - css('#gatsby-focus-wrapper > div').remove + if slug.empty? + @doc = at_css('main') + css( + (['div:first-child'] * 3).join('>'), # Tagline + 'img', + 'hr', # Footer + 'hr + div', # Footer + ).remove - # Logo and menu - css('header > div:first-child').remove + css('a').each do |link| + link.name = 'div' + link.css('h3').each do |node| + node.replace("

#{node.content}

") + end + end - # Left nav and TOC - css('main > div > div:first-child', 'aside').remove + return doc + end + + @doc = at_css('article') + # Heading & edit link + css('h1', 'h1 + a').remove unless slug.start_with?('configuration') - # Title and edit link - css('article > div:first-child').remove + if slug.start_with?('cli') + css('.header-code').each do |node| + node.name = 'span' + end + end - # Bottom divider on index - if slug == '' - css('main > hr').remove + if slug.start_with?('configuration') + css('h1', 'h2').each do |node| + node.name = node.name.sub(/\d/) { |i| i.to_i + 1 } + node.remove_attribute('style') + end end doc