Expand description
LOL HTML is a Low Output Latency streaming HTML rewriter/parser with CSS-selector based API.
It is designed to modify HTML on the fly with minimal buffering. It can quickly handle very large documents, and operate in environments with limited memory resources.
The crate serves as a back-end for the HTML rewriting functionality of Cloudflare Workers, but can be used as a standalone library with the convenient API for a wide variety of HTML rewriting/analysis tasks.
The crate provides two main API entry points:
HtmlRewriter
- a streaming HTML rewriter;rewrite_str
- one-off HTML string rewriting function.
Modules§
- The errors that can be produced by the crate’s API.
- HTML content descriptors that can be produced and modified by a rewriter.
- These module contains types to work with
Send
ableHtmlRewriter
s.
Macros§
- A convenience macro to construct a rewriting handler for HTML comments in the inner content of an element that can be matched by the specified CSS selector.
- A convenience macro to construct a rewriting handler for all HTML comments in the HTML document.
- A convenience macro to construct a rewriting handler for all text chunks in the HTML document.
- A convenience macro to construct a handler for document type declarations in the HTML document.
- A convenience macro to construct a rewriting handler for elements that can be matched by the specified CSS selector.
- A convenience macro to construct a rewriting handler for the end of the document.
- A convenience macro to construct a rewriting handler for text chunks in the inner content of an element that can be matched by the specified CSS selector.
Structs§
- This is an encoding known to be ASCII-compatible.
- Specifies document-level content handlers.
- Specifies element content handlers associated with a selector.
- A streaming HTML rewriter.
- Handler type for non-
Send
ableHtmlRewriter
s. - Specifies the memory settings for
HtmlRewriter
. - Specifies settings for the
rewrite_str
function. - Parsed CSS selector.
- Specifies settings for
HtmlRewriter
.
Traits§
- Trait used to parameterize the type of handlers used in the rewriter.
- Defines an interface for the
HtmlRewriter
’s output.
Functions§
- Rewrites given
html
string with the providedsettings
.
Type Aliases§
- Handler for HTML comments.
- Handler for the document type declaration.
- Handler for elements matched by a selector.
- Handler for the document end. This is called after the last chunk is processed.
- Handler for end tags.
- The result of a handler.
- Handler for text chunks present the HTML.