Skip to main content

Module html

Module html 

Source
Expand description

Strip-to-text conversion for html.

A streaming pass over the markup collects the visible text and nothing else. Script, style, template, and noscript content is suppressed, head content other than the title is dropped, and the title text becomes the first line. Block boundaries become line breaks: the ruled set, p, div, li, tr, br, the headings, blockquote, and pre, plus the HTML5 sectioning and grouping containers, and table cells within a row separate with a tab. Character references decode, whitespace runs collapse to one space, and blank-line runs collapse to one blank line. Reading order and table reconstruction are out of scope.

The stream never builds a document tree, so memory stays bounded under hostile nesting, and a run over the memory ceiling or the working budget fails closed. Captured text, block breaks, and cell tabs all charge one working budget, so a dense page of short blocks cannot grow converter-owned state past the order of the output ceiling. Suppression of script, style, and noscript rides the lexer’s own text typing rather than end-tag bookkeeping, so a missing closing tag cannot leak script text into the capture.

Structs§

HtmlStrip
Strip-to-text converter for html.

Constants§

HTML_STRIP_ID
Registry id of the html strip converter.
HTML_STRIP_VERSION
Version of the html strip converter.