cloudflare / cloudflare/lol-html

Restrict HTML emission to specific nodes

Open
#40 19 comments 16 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.