Skip to content

fix(convert): preserve line breaks in a multi-line table cell on export - #114

Merged
willkg merged 2 commits into
mainfrom
fix/multiline-table-cells
Aug 30, 2026
Merged

fix(convert): preserve line breaks in a multi-line table cell on export#114
willkg merged 2 commits into
mainfrom
fix/multiline-table-cells

Conversation

@willkg

@willkg willkg commented Aug 30, 2026

Copy link
Copy Markdown
Member

Summary

  • Confluence's editor writes one <p> per line inside a table cell — Enter in the editor starts a new <p>, it does not insert a <br>. cellTexts rendered sibling block children with no separator between them, so a multi-line cell like <td><p>Type: string</p><p>JQL: "Summary"</p></td> exported as Type: stringJQL: "Summary" — every line run together with no separator at all.
  • Reproduced live against https://mozilla-hub.atlassian.net/wiki/spaces/MIR/pages/2407497956/Incident+data+model+and+pipeline, whose field-reference table has several multi-line cells.
  • A real newline can't fix this: a GFM table row is exactly one physical line, so inserting one would break the table. renderCellLines joins sibling <p> content with a literal <br> instead, which GFM table cells honor as an inline line break without ending the row — and applies the same fix to a bare mid-line <br> (Shift+Enter in the editor), which was rendering as a raw two-space hard break equally unsafe inside a single row.
  • Code review then caught a related edge case: an empty <p></p> (a deliberate blank line from pressing Enter twice) was being silently dropped instead of preserved as an empty line. Fixed in a second commit.

Fixes #113.

Test plan

  • Added TestStorageToMarkdownJoinsMultilineCells (multi-line cells, mid-line <br>, a plain no-wrapper cell unaffected, a genuinely blank line preserved, and round-trip stability)
  • make check passes (vet, fmt-check, test, build, lint)
  • Re-ran export against the live page that originally exposed the bug and confirmed lines are now preserved

willkg added 2 commits August 30, 2026 08:10
Confluence writes one <p> per line inside a cell -- Enter in the
editor starts a new <p>, it does not insert a <br> -- and cellTexts
rendered every child through the ordinary block path, which has no
separator between siblings, running all the lines together with no
space at all.

A real newline can't fix this: a GFM table row is exactly one
physical line. renderCellLines joins sibling <p> content with a
literal <br> instead, which GFM table cells honor as a line break
without ending the row, and applies the same substitution to a bare
mid-line <br> (Shift+Enter), which was rendering as the two-space
hard break valid in block content but not inside a single row.

Reproduced live against MIR/2407497956, whose field-reference table
has several multi-line cells.

Fixes #113.
Code review found that renderCellLines's per-<p> branch only kept a
line when it rendered non-empty, so an empty <p></p> -- a deliberate
blank line from pressing Enter twice in the editor -- contributed
nothing instead of an empty line, silently merging two paragraphs
that should stay apart. The equivalent authored as a bare <br><br>
(no <p> wrapper) already round-tripped correctly, which is what
exposed the asymmetry.
@willkg
willkg merged commit 81b7211 into main Aug 30, 2026
1 check passed
@willkg
willkg deleted the fix/multiline-table-cells branch August 30, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

read/export: a multi-line table cell loses its line breaks entirely

1 participant