defuddle-cli icon indicating copy to clipboard operation
defuddle-cli copied to clipboard

CSS parsing error causes raw CSS output instead of page content

Open churnish opened this issue 9 months ago • 1 comments

Description

When parsing certain pages, Defuddle outputs raw CSS instead of the actual page content. The underlying issue is a CSS parsing error in jsdom, but Defuddle's error handling doesn't gracefully degrade — it returns whatever it managed to extract, which in this case is a <style> block.

Steps to reproduce

defuddle parse "https://code.claude.com/docs/en/hooks-guide" --md

Expected behavior

Returns the page's markdown content (documentation about Claude Code hooks).

Actual behavior

jsdom throws a CSS parsing error, then the output is raw CSS (button styling, layout rules) with zero actual documentation content:

Error: Could not parse CSS stylesheet
    at exports.createStylesheet (jsdom/lib/jsdom/living/helpers/stylesheets.js:37:21)
    at HTMLStyleElementImpl._updateAStyleBlock (jsdom/lib/jsdom/living/nodes/HTMLStyleElement-impl.js:68:5)
    ...

/* These styles mirror our design system ... */
.btn {
  position: relative;
  display: inline-flex;
  ...
}

Environment

  • defuddle-cli (installed globally via npm)
  • macOS 26.3
  • Node.js v22

🤖 Generated with Claude Code

churnish avatar Mar 02 '26 11:03 churnish

Defuddle CLI is now part of the main Defuddle repo.

kepano avatar Mar 02 '26 14:03 kepano