Defuddle version: 0.19.2
Repository: https://github.com/kepano/defuddle
Summary
Defuddle silently drops content inside HTML elements with data-component-part attributes (such as data-component-part="step-content" and data-component-part="step-title") when those elements appear anywhere inside an ancestor with role="list". This affects pages rendered by Mintlify's documentation framework, which uses custom React/MDX Step and Steps components that serialize to role="list" containers with data-component-part children.
The content is simply absent from the Markdown output — there is no warning, placeholder, or any indication that content was skipped. Content with data-component-part but without a role="list" ancestor is handled correctly regardless of nesting depth.
I encountered this problem when using obsidian clipper on https://code.claude.com/docs/en/best-practices#explore-first-then-plan-then-code, noticing that some content was dropped.
Example Input
<!doctype html>
<html>
<body>
<p>Before.</p>
<div role="list">
<div role="listitem">
<div data-component-part="step-title">Title</div>
<div data-component-part="step-content">
<p>Content</p>
</div>
</div>
</div>
<p>After.</p>
</body>
</html>
Expected Output
Before.
Title
Content
After.
(Or some other reasonable Markdown representation of the structured list content.)
Actual Output
Running npx defuddle parse input.html --md produces:
The heading and the three <p> elements inside data-component-part="step-content" are all silently dropped — no warning, no empty placeholder, nothing.
Bug Notes
Content extraction within data-component-part elements is not universally dropped. It depends on the nesting context.
Concrete Output (verified with defuddle 0.19.2)
output_source_excerpt.txt — Real-world Steps component HTML:
Only the intro paragraph and ending paragraph survive in the output:
## Test: Steps component content dropped
The following content is wrapped in custom Step/Steps component markup...
This paragraph is after the Steps component and should appear in the output.
All three Step items (Explore, Plan, Code) with their titles, paragraphs, and code blocks are completely absent — no trace in the output.
output_test_comprehensive.txt — Nesting-depth tests:
Standard paragraph at the start.
Test 1: Direct child of body
Test 2: One wrapper div deep
Test 3: Two wrapper divs deep
Test 4: Inside role="listitem"
Test 5: nested deeper in listitem
Test 9: listitem only, no data-component-part
Standard paragraph at the end.
Only T6, T7, and T8 are truly absent (their text does not appear in the output at all). All other tests produce output.
Test Results
A comprehensive nesting-depth test (test_comprehensive.html) was run against defuddle 0.19.2. Note: the --md flag is not recognized (output is plain text, not Markdown-formatted).
Concrete nesting patterns table
| Test |
Structure |
Visible? |
| T1 |
body > div[data-component-part] |
Appears |
| T2 |
body > div > div[data-component-part] |
Appears |
| T3 |
body > div > div > div[data-component-part] |
Appears |
| T4 |
body > div[role="listitem"] > div[data-component-part] |
Appears |
| T5 |
body > div[role="listitem"] > div > div[data-component-part] |
Appears |
| T6 |
body > div[role="list"] > div[role="listitem"] > div[data-component-part] |
Dropped |
| T7 |
body > div[role="list"] > div[role="listitem"] > div > div[data-component-part] |
Dropped |
| T8 |
body > div[role="list"] > div > div[data-component-part] |
Dropped |
| T9 |
body > div[role="listitem"] (no data-component-part) |
Appears |
| Steps |
Real Steps component (role="list" > listitem > data-component-part) |
All step content dropped |
Corrected Pattern
The bug is specifically tied to role="list" ancestry. Content is dropped only when a data-component-part element appears anywhere inside an ancestor with role="list" (T6, T7, T8). Without a role="list" ancestor, data-component-part elements are handled correctly regardless of depth: direct children of <body> (T1), nested in wrapper divs (T2, T3), inside role="listitem" alone (T4, T5), or anywhere else — all produce output.
The key trigger is that defuddle's tree traversal has a special handler for role="list" elements, and within that handler, data-component-part children are either:
- Not recursed into at all
- Or their content is collapsed/cleared during the list-processing logic
A role="listitem" element without an enclosing role="list" does NOT trigger the bug.
Possible Root Cause (Code Analysis)
Looking at the md.ts source code in defuddle 0.19.2, the likely bug location is in the extractContent function's handler for role="list" elements. The function has a special code path that processes role="list" containers: it iterates over child elements (expected to be role="listitem"), but when those child elements contain data-component-part attributes, the content extraction enters a code path that drops them.
The probable flow:
- Function enters a
role="list" element
- It finds child elements and processes each one with list-item handling logic
- Inside list-item handling,
data-component-part children are either:
- Skipped because the list handler assumes all content is in direct text children, not in attribute-tagged divs
- Or collapsed/cleared by the
data-component-part inline-child collapse logic being applied at the wrong scope
The fact that all nesting contexts inside role="list" are affected (T6-T8) — regardless of depth — suggests the role="list" handler simply doesn't recurse into child elements that carry data-component-part attributes, rather than a depth-sensitive collapse bug.
Reproduction
# Save the example HTML above as test.html, then run:
npx defuddle parse test.html --md
minimal_example.html
output_minimal_example.txt
test_comprehensive.html
output_test_comprehensive.txt
Defuddle version: 0.19.2
Repository: https://github.com/kepano/defuddle
Summary
Defuddle silently drops content inside HTML elements with
data-component-partattributes (such asdata-component-part="step-content"anddata-component-part="step-title") when those elements appear anywhere inside an ancestor withrole="list". This affects pages rendered by Mintlify's documentation framework, which uses custom React/MDX Step and Steps components that serialize torole="list"containers withdata-component-partchildren.The content is simply absent from the Markdown output — there is no warning, placeholder, or any indication that content was skipped. Content with
data-component-partbut without arole="list"ancestor is handled correctly regardless of nesting depth.I encountered this problem when using obsidian clipper on https://code.claude.com/docs/en/best-practices#explore-first-then-plan-then-code, noticing that some content was dropped.
Example Input
Expected Output
(Or some other reasonable Markdown representation of the structured list content.)
Actual Output
Running
npx defuddle parse input.html --mdproduces:The heading and the three
<p>elements insidedata-component-part="step-content"are all silently dropped — no warning, no empty placeholder, nothing.Bug Notes
Content extraction within
data-component-partelements is not universally dropped. It depends on the nesting context.Concrete Output (verified with defuddle 0.19.2)
output_source_excerpt.txt— Real-world Steps component HTML:Only the intro paragraph and ending paragraph survive in the output:
All three Step items (Explore, Plan, Code) with their titles, paragraphs, and code blocks are completely absent — no trace in the output.
output_test_comprehensive.txt— Nesting-depth tests:Only T6, T7, and T8 are truly absent (their text does not appear in the output at all). All other tests produce output.
Test Results
A comprehensive nesting-depth test (
test_comprehensive.html) was run against defuddle 0.19.2. Note: the--mdflag is not recognized (output is plain text, not Markdown-formatted).Concrete nesting patterns table
body > div[data-component-part]body > div > div[data-component-part]body > div > div > div[data-component-part]body > div[role="listitem"] > div[data-component-part]body > div[role="listitem"] > div > div[data-component-part]body > div[role="list"] > div[role="listitem"] > div[data-component-part]body > div[role="list"] > div[role="listitem"] > div > div[data-component-part]body > div[role="list"] > div > div[data-component-part]body > div[role="listitem"](nodata-component-part)role="list"> listitem > data-component-part)Corrected Pattern
The bug is specifically tied to
role="list"ancestry. Content is dropped only when adata-component-partelement appears anywhere inside an ancestor withrole="list"(T6, T7, T8). Without arole="list"ancestor,data-component-partelements are handled correctly regardless of depth: direct children of<body>(T1), nested in wrapper divs (T2, T3), insiderole="listitem"alone (T4, T5), or anywhere else — all produce output.The key trigger is that defuddle's tree traversal has a special handler for
role="list"elements, and within that handler,data-component-partchildren are either:A
role="listitem"element without an enclosingrole="list"does NOT trigger the bug.Possible Root Cause (Code Analysis)
Looking at the
md.tssource code in defuddle 0.19.2, the likely bug location is in theextractContentfunction's handler forrole="list"elements. The function has a special code path that processesrole="list"containers: it iterates over child elements (expected to berole="listitem"), but when those child elements containdata-component-partattributes, the content extraction enters a code path that drops them.The probable flow:
role="list"elementdata-component-partchildren are either:data-component-partinline-child collapse logic being applied at the wrong scopeThe fact that all nesting contexts inside
role="list"are affected (T6-T8) — regardless of depth — suggests therole="list"handler simply doesn't recurse into child elements that carrydata-component-partattributes, rather than a depth-sensitive collapse bug.Reproduction
# Save the example HTML above as test.html, then run: npx defuddle parse test.html --mdminimal_example.html
output_minimal_example.txt
test_comprehensive.html
output_test_comprehensive.txt