diff --git a/lib/docs/filters/rust/clean_html.rb b/lib/docs/filters/rust/clean_html.rb index 42ac2a83..f42b714a 100644 --- a/lib/docs/filters/rust/clean_html.rb +++ b/lib/docs/filters/rust/clean_html.rb @@ -88,8 +88,12 @@ module Docs end css('pre').each do |node| + node.css('.where.fmt-newline').each do |node| + node.before("\n") + end node.content = node.content node['data-language'] = 'rust' if node['class'] && node['class'].include?('rust') + node['data-language'] = 'rust' if node.classes.include?('code-header') end doc.first_element_child.name = 'h1' if doc.first_element_child.name = 'h2' diff --git a/lib/docs/scrapers/rust.rb b/lib/docs/scrapers/rust.rb index 7f18e0a3..90bdf77c 100644 --- a/lib/docs/scrapers/rust.rb +++ b/lib/docs/scrapers/rust.rb @@ -53,5 +53,10 @@ module Docs def process_response?(response) !(response.body =~ REDIRECT_RGX || response.body =~ NOT_FOUND_RGX || response.body.blank?) end + + def parse(response) # Hook here because Nokogori removes whitespace from headings + response.body.gsub! %r{}, '
'
+      super
+    end
   end
 end