Files
moli/moli-html2md/src/structure.rs
T
ldm0 9e44790756 fix(html2md): share structural block boundaries across output paths
Share structural classifications with the HTML fallback so authored blocks retain boundaries. Cover adjacent sections and related semantic blocks, and retain the authored center wrappers in the layout fixture.
2026-10-28 03:43:27 +07:00

65 lines
1.5 KiB
Rust

pub(crate) fn is_block(tag: &str) -> bool {
is_structural_block(tag)
|| matches!(
tag,
"audio" | "canvas" | "frameset" | "isindex" | "noframes" | "output"
)
}
/// These elements already own their document/list/choice boundaries.
pub(crate) fn owns_boundaries(tag: &str) -> bool {
is_structural_block(tag) || matches!(tag, "select" | "optgroup" | "option" | "col" | "colgroup")
}
pub(crate) fn is_structural_block(tag: &str) -> bool {
matches!(
tag,
"address"
| "article"
| "aside"
| "blockquote"
| "body"
| "caption"
| "center"
| "dd"
| "details"
| "dialog"
| "dir"
| "div"
| "dl"
| "dt"
| "fieldset"
| "figcaption"
| "figure"
| "footer"
| "form"
| "h1"
| "h2"
| "h3"
| "h4"
| "h5"
| "h6"
| "header"
| "hgroup"
| "html"
| "legend"
| "li"
| "main"
| "menu"
| "nav"
| "ol"
| "p"
| "pre"
| "section"
| "summary"
| "table"
| "tbody"
| "td"
| "tfoot"
| "th"
| "thead"
| "tr"
| "ul"
)
}