diff --git a/crates/typst-pdf/src/tags/table.rs b/crates/typst-pdf/src/tags/table.rs index 21387ad5d..35c8e1b01 100644 --- a/crates/typst-pdf/src/tags/table.rs +++ b/crates/typst-pdf/src/tags/table.rs @@ -180,7 +180,10 @@ impl TableCtx { .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(); @@ -399,7 +402,7 @@ mod tests { TagNode::Group( TagKind::TH(TableHeaderCell::new(scope).with_headers(TagIdRefs { ids })) .with_id(Some(id)), - Vec::new(), + vec![TagNode::Group(TagKind::P.into(), Vec::new())], ) } @@ -410,7 +413,7 @@ mod tests { .collect(); TagNode::Group( TagKind::TD(TableDataCell::new().with_headers(TagIdRefs { ids })).into(), - Vec::new(), + vec![TagNode::Group(TagKind::P.into(), Vec::new())], ) }