feat: don't wrap table cell content in paragraph

This commit is contained in:
Tobias Schmitz 2025-07-14 10:13:21 +02:00
parent 2621c6416e
commit e4021390a3
No known key found for this signature in database

View File

@ -180,11 +180,7 @@ impl TableCtx {
) )
.into(), .into(),
}; };
Some(TagNode::Group(tag, cell.nodes))
// Wrap content in a paragraph.
// TODO: maybe avoid nested paragraphs?
let par = TagNode::Group(TagKind::P.into(), cell.nodes);
Some(TagNode::Group(tag, vec![par]))
}) })
.collect(); .collect();
@ -422,7 +418,7 @@ mod tests {
TagNode::Group( TagNode::Group(
TagKind::TH(TableHeaderCell::new(scope).with_headers(TagIdRefs { ids })) TagKind::TH(TableHeaderCell::new(scope).with_headers(TagIdRefs { ids }))
.with_id(Some(id)), .with_id(Some(id)),
vec![TagNode::Group(TagKind::P.into(), Vec::new())], Vec::new(),
) )
} }
@ -433,7 +429,7 @@ mod tests {
.collect(); .collect();
TagNode::Group( TagNode::Group(
TagKind::TD(TableDataCell::new().with_headers(TagIdRefs { ids })).into(), TagKind::TD(TableDataCell::new().with_headers(TagIdRefs { ids })).into(),
vec![TagNode::Group(TagKind::P.into(), Vec::new())], Vec::new(),
) )
} }