Bun provides a fast native implementation of the `HTMLRewriter` pattern developed by Cloudflare. It provides a convenient, `EventListener`-like API for traversing and transforming HTML documents. ```ts const rewriter = new HTMLRewriter(); rewriter.on("*", { element(el) { console.log(el.tagName); // "body" | "div" | ... }, }); ``` To parse and/or transform the HTML: ```ts#rewriter.ts rewriter.transform( new Response(` My First HTML Page

My First Heading

My first paragraph.

`)); ``` View the full documentation on the [Cloudflare website](https://developers.cloudflare.com/workers/runtime-apis/html-rewriter/).