Hidden-element removal treats Tailwind state variants such as empty:hidden as hidden and removes visible content
Versions: defuddle 0.19.4 and 0.19.6 (CLI: defuddle parse --markdown). The same code is on main (3e8bde9f5f).
Pages:
- https://langfuse.com/docs/evaluation/evaluation-methods/code-evaluators
- https://langfuse.com/docs/evaluation/evaluation-methods/decision-models
The pages put the text of each note box (callout) in this element:
<div class="text-text-secondary text-[14px] prose-no-margin empty:hidden"><p>...</p></div>
Result: All note boxes are missing from the output. The page shows them, because empty:hidden hides an element only when it has no content. Examples of lost text:
- "Production pattern: Teams typically use Experiments during development ..." (code-evaluators)
- "Keep each question atomic: one decision per question. ..." (decision-models)
Cause: removeHiddenElements (src/removals/hidden.ts) removes each element with a class token that ends with :hidden. That test is correct for responsive variants such as sm:hidden. It is not correct for state variants such as empty:hidden, because these hide the element only in a state that the page does not have.
Reproduction:
curl -sL -A "Mozilla/5.0" -o page.html https://langfuse.com/docs/evaluation/evaluation-methods/code-evaluators
npx -y [email protected] parse page.html --markdown | grep -c "Production pattern" # 0
sed 's/ empty:hidden//g' page.html > fixed.html
npx -y [email protected] parse fixed.html --markdown | grep -c "Production pattern" # 1
With empty:hidden removed, the code-evaluators output grows from 17,568 to 18,504 characters, and all note boxes come back. The decision-models page has 11 empty:hidden tokens; with them removed, its note boxes also come back.
Suggestion: Skip state variants that do not hide visible content, for example empty:hidden. Another option: remove an element with empty:hidden only when it has no text and no child elements.