@@ -1768,6 +1768,13 @@ fn generate_element(
17681768 ElementKind::Noscript => "noscript",
17691769 ElementKind::Address => "address",
17701770 ElementKind::Search => "search",
1771+ // Heading elements
1772+ ElementKind::H1 => "h1",
1773+ ElementKind::H2 => "h2",
1774+ ElementKind::H3 => "h3",
1775+ ElementKind::H4 => "h4",
1776+ ElementKind::H5 => "h5",
1777+ ElementKind::H6 => "h6",
17711778 ElementKind::Image
17721779 | ElementKind::Input
17731780 | ElementKind::HorizontalRule
@@ -1845,6 +1852,12 @@ fn generate_element(
18451852 ElementKind::Noscript => "noscript",
18461853 ElementKind::Address => "address",
18471854 ElementKind::Search => "search",
1855+ ElementKind::H1 => "h1",
1856+ ElementKind::H2 => "h2",
1857+ ElementKind::H3 => "h3",
1858+ ElementKind::H4 => "h4",
1859+ ElementKind::H5 => "h5",
1860+ ElementKind::H6 => "h6",
18481861 _ => "",
18491862 };
18501863
@@ -2000,6 +2013,12 @@ fn generate_element(
20002013 | ElementKind::Tooltip
20012014 | ElementKind::Chip
20022015 | ElementKind::Tag
2016+ | ElementKind::H1
2017+ | ElementKind::H2
2018+ | ElementKind::H3
2019+ | ElementKind::H4
2020+ | ElementKind::H5
2021+ | ElementKind::H6
20032022 ) && let Some(text) = &elem.argument
20042023 {
20052024 out.push_str(&html_escape(text));
@@ -2007,7 +2026,16 @@ fn generate_element(
20072026
20082027 // Children
20092028 ctx.depth += 1;
2010− let is_paragraph = elem.kind == ElementKind::Paragraph;
2029+ let is_paragraph = matches!(
2030+ elem.kind,
2031+ ElementKind::Paragraph
2032+ | ElementKind::H1
2033+ | ElementKind::H2
2034+ | ElementKind::H3
2035+ | ElementKind::H4
2036+ | ElementKind::H5
2037+ | ElementKind::H6
2038+ );
20112039 for (i, child) in elem.children.iter().enumerate() {
20122040 generate_node(child, Some(&elem.kind), out, styles, ctx);
20132041 if is_paragraph && i < elem.children.len() - 1 {
@@ -2537,7 +2565,13 @@ fn attrs_to_css(
25372565 | ElementKind::Form
25382566 | ElementKind::Details
25392567 | ElementKind::Dialog => css.push_str(FLEX_COLUMN),
2540− ElementKind::Paragraph => css.push_str("margin:0;"),
2568+ ElementKind::Paragraph
2569+ | ElementKind::H1
2570+ | ElementKind::H2
2571+ | ElementKind::H3
2572+ | ElementKind::H4
2573+ | ElementKind::H5
2574+ | ElementKind::H6 => css.push_str("margin:0;"),
25412575 // Lists: reset browser defaults
25422576 ElementKind::List => css.push_str("margin:0;padding-left:0;list-style:none;"),
25432577 // Figure / Blockquote: flex column with browser margin reset