From 8ceba764dd6c0913b8e6ad0789623979ac213239 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Fri, 26 Feb 2021 08:24:59 +0100 Subject: [PATCH] react_bootstrap: clean html --- lib/docs/filters/react_bootstrap/clean_html.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/docs/filters/react_bootstrap/clean_html.rb b/lib/docs/filters/react_bootstrap/clean_html.rb index f7bd995d..761e9617 100644 --- a/lib/docs/filters/react_bootstrap/clean_html.rb +++ b/lib/docs/filters/react_bootstrap/clean_html.rb @@ -2,12 +2,14 @@ module Docs class ReactBootstrap class CleanHtmlFilter < Filter def call + @doc = doc.at_css('main') + css('.flex-column.d-flex').remove css('header').remove css('.bs-example').remove css('.position-relative pre').each do |node| - # node.content = node.content + node.content = node.children.map(&:content).join("\n") node.remove_attribute('style') node['data-language'] = 'jsx' node.parent.replace(node) @@ -16,6 +18,10 @@ module Docs css('div, main, pre, h1, h2, h3, h4, h5, h6, a, p').each do |node| node.delete 'class' end + css('h1, h2, h3, h4, h5, h6').each do |node| + node.css('a').remove + node.content = node.content + end css('#___gatsby, #gatsby-focus-wrapper').each do |node| node.delete 'id'