diff options
| author | Tobias Schmitz <tobiasschmitz2001@gmail.com> | 2025-07-07 12:30:56 +0200 |
|---|---|---|
| committer | Tobias Schmitz <tobiasschmitz2001@gmail.com> | 2025-07-07 12:30:56 +0200 |
| commit | 7d5b9a716f48df3f7e9ca35839defcc2ee131b33 (patch) | |
| tree | 99b6e01406057787210fccf49dd8ab5a70ad7684 | |
| parent | b0d3c2dca4871e716241e09734340f45b1b2cd7a (diff) | |
feat: wrap table cell content in a paragraph
| -rw-r--r-- | crates/typst-pdf/src/tags/table.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/typst-pdf/src/tags/table.rs b/crates/typst-pdf/src/tags/table.rs index 21387ad5..35c8e1b0 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())], ) } |
