Expand description
Shared HTML block-start classification.
A line whose first tag names one of these elements starts an HTML block in
rumdl’s parser (lint_context::heading_detection::detect_html_blocks).
Reflow consults the same predicate so a wrapped line can never introduce a
construct the parser would classify differently: the two must agree, and
sharing the list keeps them from drifting apart.
Constants§
- BLOCK_
ELEMENTS - HTML elements whose tags open an HTML block at line start (CommonMark type-1 and type-6 conditions, as recognized by rumdl’s parser).
- NON_
SPEC_ BLOCK_ ELEMENTS - The elements of
BLOCK_ELEMENTSthat CommonMark does not name in its type-1 or type-6 start conditions. A spec parser opens a block on one only through start condition 7, which parsers disagree on where a block may start: after a table row, markdown-rs ends the table there and pulldown-cmark reads the tag as the next row. - TYPE_
1_ BLOCK_ ELEMENTS - Type-1 tags per CommonMark: blank lines inside these blocks do not terminate them — only a matching end tag (or EOF) does.
Functions§
- complete_
tag_ len - The byte length of the complete HTML open tag or closing tag
textstarts with, as CommonMark defines one:<name, attributes each preceded by whitespace (with an unquoted, single-quoted or double-quoted value), then optional whitespace and>or/>; or</name, optional whitespace and>. Only spaces and tabs count as whitespace, since the caller holds a single line. - opens_
tag_ line_ html_ block - Whether
trimmed(a line with leading whitespace already stripped) opens an HTML block through CommonMark start condition 7: a complete open or closing tag of any element but the type-1 raw ones, followed by nothing but whitespace. Unlike every other HTML block such a line cannot interrupt a paragraph, so it matters only where a paragraph starts, and whether a line qualifies depends on all of its text, not on how it begins. - opens_
untagged_ html_ block - Whether
trimmed(a line with leading whitespace already stripped) opens an HTML block that no tag name identifies: a comment, a processing instruction, a declaration or a CDATA section (CommonMark start conditions 2 to 5). Each interrupts a paragraph like a block-level tag does, and none of them is a tagparse_html_block_startcan name, so a caller asking “does this line start a block?” needs both. - parse_
html_ block_ start - If
trimmed(a line with leading whitespace already stripped) opens an HTML block per rumdl’s parser, return the lowercased tag name and whether it is a closing tag. ReturnsNonefor text, autolinks, and inline-level tags (<span>,<b>, …), which cannot interrupt a paragraph.