pub fn parse_html_elements(html: &str) -> Vec<ParsedElement>Expand description
Read html into blocks and tables.
The reader recurses once per element level it follows, up to MAX_HTML_READ_DEPTH,
and a stack overflow aborts the process: a debug build ran out of a spawned thread’s
stack on a paste nested some 200 elements deep, and a host reading on a smaller thread
sooner. A tree nested deeper than a caller’s stack is sure to hold is read on a thread
of its own, with a stack sized for its depth; when no thread can be started, it is read
on the caller’s stack to HTML_DEPTH_ON_THE_CALLERS_STACK levels, each subtree
deeper than that read as its text. The quotations it holds are kept within
MAX_QUOTE_LEVELS (see
quote_depth).
Whitespace is kept where an element’s white-space says so: in its inline style, and
in a <style> block whose rule names only * or bare tags, as
p, li { white-space: pre-wrap; } does (what Qt writes). A rule with a class, id,
attribute, pseudo-class or combinator in its selector, a rule inside an at-rule such as
@media, a <style> of another type or for print, and every other property, is
ignored. Blanks alone between two blocks stay layout; between two inline siblings they are
the space between two words. Known limits: a rule with a class or id is not applied, and
neither is what it overrides (p.plain { white-space: normal } over p { white-space: pre }
leaves the paragraphs of the class kept); pre-line and nowrap collapse all whitespace,
as they do in an inline style; and a pre from a sheet, unlike one in an inline style,
does not mark the block non-breakable.