Skip to content

fix(convert): pass through a list inside a table cell instead of mangling it - #117

Merged
willkg merged 3 commits into
mainfrom
fix/list-in-table-cell
Aug 30, 2026
Merged

fix(convert): pass through a list inside a table cell instead of mangling it#117
willkg merged 3 commits into
mainfrom
fix/list-in-table-cell

Conversation

@willkg

@willkg willkg commented Aug 30, 2026

Copy link
Copy Markdown
Member

Summary

  • Documented <br> for multi-line table cells (fixed in read/export: a multi-line table cell loses its line breaks entirely #113, never written up in the README).
  • While writing README documentation for using <ul>/<ol>/<li> directly in a table cell (a real markdown list needs one line per item, which a GFM table row can't do), found the export side was actually broken: the write direction works fine, but renderCellLines (added for read/export: a multi-line table cell loses its line breaks entirely #113) only special-cased <p> as a block boundary, so a <ul>/<ol> fell into the inline "run" bucket and rendered with no separator between items at all — <ul><li>one</li><li>two</li></ul> exported as onetwo.
  • Fixed by treating <ul>/<ol> as their own line too, passed through as raw serialized tags rather than converted (the same approach already used elsewhere for content that can't be expressed as pure markdown).
  • Code review then found that reusing cellTexts's blanket |\| escape (needed so literal pipe text doesn't get read as a column boundary) against the new raw-HTML passthrough corrupted a link's href containing a | — a backslash has no escaping meaning inside a quoted attribute. Fixed by moving the escape into renderCellLines, applied only to rendered text, never to serialize's raw output.
  • The same root cause also reaches a plain <a href> link outside any list (pre-existing, unrelated to this fix) — filed separately as read/export: a literal pipe in a table cell link's URL gets corrupted #116 since fixing it needs a larger change (escaping a link's text apart from its destination).

Fixes #115.

Test plan

  • Added TestStorageToMarkdownPassesThroughListsInCells (<ul>/<ol> passthrough, Confluence-editor <li><p> shape, pipe-in-href correctness, round-trip stability)
  • make check passes (vet, fmt-check, test, build, lint)

willkg added 3 commits August 30, 2026 08:45
Fixed in #113 but never written up: a table cell that needs more
than one line uses a literal <br>, since a GFM table row has to stay
on one physical line and a real newline isn't an option.
…ling it

Found while writing README documentation for using <ul>/<ol>/<li>
directly in a table cell (a real markdown list needs one line per
item, which a GFM table row can't do). The write side already
handles it -- goldmark's raw HTML passthrough carries the tags into
storage unchanged -- but renderCellLines (added for #113) only
special-cased <p> as a block boundary; a <ul>/<ol> fell into the
inline "run" bucket and rendered as plain inline content with no
separator between items at all. "<ul><li>one</li><li>two</li></ul>"
exported as "onetwo".

renderCellLines now treats <ul>/<ol> as their own line too, passed
through as raw serialized tags rather than converted -- the same
approach already used elsewhere for content that can't be expressed
as pure markdown.

Fixes #115.
Code review found that cellTexts's blanket "|" -> "\|" escape --
needed so literal pipe text doesn't get read as a column boundary in
the single-line row a cell becomes -- was also being applied to the
<ul>/<ol> passthrough this fix added. A backslash has no escaping
meaning inside a quoted HTML attribute, so a link's href containing
a "|" inside a passed-through list came back corrupted with a
literal backslash baked in, which republishing would make permanent.

Moved the escape into renderCellLines itself, applied only to
rendered <p>/inline text, never to serialize's raw output. The same
root cause reaches a plain <a href> outside any list too, which
predates this fix and is filed separately as #116 -- fixing that
needs the escape to apply to a link's text and not its destination,
which isn't reachable from cellTexts once the two are already
merged into one rendered string.
@willkg
willkg merged commit 116beac into main Aug 30, 2026
1 check passed
@willkg
willkg deleted the fix/list-in-table-cell branch August 30, 2026 13:18
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 list inside a table cell is mangled, not just unstyled

1 participant