From 70c5489f52fb29a7b280f817baff9cde874b3952 Mon Sep 17 00:00:00 2001 From: Gergely Gombos Date: Wed, 11 Dec 2024 00:45:43 +0100 Subject: [PATCH] add search entries --- lib/docs/filters/react/entries_react_dev.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/docs/filters/react/entries_react_dev.rb b/lib/docs/filters/react/entries_react_dev.rb index 80b5aad0..f3efff4b 100644 --- a/lib/docs/filters/react/entries_react_dev.rb +++ b/lib/docs/filters/react/entries_react_dev.rb @@ -24,6 +24,18 @@ module Docs canary_copy = '- This feature is available in the latest Canary' return string.sub(canary_copy, ' (Canary)') end + + def additional_entries + excluded = %w(usage troubleshooting recap reference challenges alternatives) + entries = [] + css('article h2, article h3').map do |node| + next unless node.has_attribute?('id') + name = node.content.strip + next if excluded.include?(name.downcase) + entries << [name, node['id'], type] + end + return entries + end end end end