Clutter removal removes content sections whose id contains a partial-selector word (for example "error-")
Versions: defuddle 0.19.4 and 0.19.6 (CLI: defuddle parse --json --markdown)
Page: https://hamel.dev/blog/posts/evals-faq/ (a Quarto page). Each section uses a heading slug as its id, for example:
<section id="error-analysis-data-collection" class="level1">
<section id="q-whats-your-favorite-eval-vendor" class="level2">
Result: 16 of the 61 FAQ questions are missing from the output. Debug mode shows Removed clutter elements: { exactSelectors: 80, partialSelectors: 114 }.
Cause: Defuddle matches the PARTIAL_SELECTORS values as substrings of the id attribute. The slug ids match these words:
error-matcheserror-analysis-data-collection. This removes a whole group of 12 questions.relevant,recommend,favoriteanderror-match 4 more question ids.
Reproduction:
- Save the page HTML.
- Run
defuddle parse --json --markdown page.html. The text "Building evals is a pipeline" is not in the output. - Rename every
<section id="...">to a neutral id (sec1,sec2, ...) and run the command again. All 8 test phrases come back. The output grows from 96,179 to 131,671 characters. The h3 count grows from 31 to 49 (the page has 50).
Suggestion: Do not apply partial matching to an element that holds main content. Examples: a section with a heading child, or an element that holds a large part of the page text. Another option: do not test id values that are heading slugs.