PuerkitoBio/goquery ? reverse-engineered prompt

Reverse engineered prompt

Build me a Go package for working with HTML that feels a lot like jQuery.

I want to be able to load an HTML document, find elements with CSS style selectors, walk up and down the tree, filter matches, read attributes and text, and make simple edits like adding, removing, wrapping, replacing, and setting HTML or text. It should be easy to chain calls together so the code stays readable, and it should work with Go’s HTML parser rather than expecting a full browser DOM.

Please make it safe and practical for scraping and small HTML transformations, with helpful behavior when selectors are invalid, and clear helpers for things like getting the first match, iterating over matches, and rendering the result back out. Keep the API clean and familiar, and follow Go conventions. If you need to check current docs for the underlying HTML and selector packages, go ahead and look them up online.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab