Functions
_split_protected_regions
Split HTML into segments, marking whitespace-sensitive regions to preserve.
Returns list of tuples…
_split_protected_regions
def _split_protected_regions(html: str) -> list[tuple[str, bool]]
Split HTML into segments, marking whitespace-sensitive regions to preserve.
Returns list of tuples: (segment_text, is_protected)
Parameters 1
| Name | Type | Default | Description |
|---|---|---|---|
html |
str |
— |
Returns
list[tuple[str, bool]]
_pretty_indent_html
Indent non-protected HTML lines with two spaces per nesting level.
Depth carries across protected …
_pretty_indent_html
def _pretty_indent_html(html: str) -> str
Indent non-protected HTML lines with two spaces per nesting level.
Depth carries across protected segments, but protected content is left untouched.
Parameters 1
| Name | Type | Default | Description |
|---|---|---|---|
html |
str |
— |
Returns
str
format_html_output
Format HTML to produce pristine output, preserving whitespace-sensitive regions.
format_html_output
def format_html_output(html: str, mode: str = 'raw', options: dict[str, Any] | None = None) -> str
Format HTML to produce pristine output, preserving whitespace-sensitive regions.
Parameters 3
| Name | Type | Default | Description |
|---|---|---|---|
html |
str |
— | Input HTML string |
mode |
str |
'raw' |
"raw" (no-op), "pretty" (stable whitespace), or "minify" (compact inter-tag spacing) |
options |
dict[str, Any] | None |
None |
optional flags, e.g., {"remove_comments": True, "collapse_blank_lines": True} |
Returns
Formatted HTML stringstr
—