cloudflare / cloudflare/lol-html
Restrict HTML emission to specific nodes
Open
AREA: production code
enhancement
- Dominant language
- Rust
- Stars
- 2.1k
- Forks
- 111
- PR merge metrics
- No merged PRs in 30d
Description
**Feature request**: I'd love the ability to extract html from a CSS selector. Currently it seems there's no good way to do so. Perhaps like so:
```js
const extractedHtml = new HTMLRewriter().on('#my-id', {
element(e) {
e.extract();
}
}).transform(response);
```
Not sure that'd be the most appropriate syntax given the nature of extracting vs. modifying/removing.
More context: https://community.cloudflare.com/t/htmlrewriter-extract-and-serve-single-dom-node/136769
Contributor guide
Assessment
This issue has not been assessed yet.