fix(convert): preserve line breaks in a multi-line table cell on export - #114
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
<p>per line inside a table cell — Enter in the editor starts a new<p>, it does not insert a<br>.cellTextsrendered 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 asType: stringJQL: "Summary"— every line run together with no separator at all.renderCellLinesjoins 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.<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
TestStorageToMarkdownJoinsMultilineCells(multi-line cells, mid-line<br>, a plain no-wrapper cell unaffected, a genuinely blank line preserved, and round-trip stability)make checkpasses (vet, fmt-check, test, build, lint)exportagainst the live page that originally exposed the bug and confirmed lines are now preserved