You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cceb8a7
Browse filesBrowse the repository at this point in the historyBrowse files
Read tables back as Markdown instead of smearing their cells
HTMLToMarkdown had no table handling: <table> markup survived every pass
untouched until the final tag-stripping regex deleted the tags and ran the
cell text together. Display of any table-bearing message, comment, or to-do
description came out as one smeared line, and the TUI in-place editors had to
refuse table-bearing content wholesale to avoid destroying it on resubmit.
Convert tables to GFM pipe tables instead. A new pass runs while row and cell
tags are still intact: each <table> block is extracted (BC3 rich text is
sanitized editor output — always flat editor-authored grids, so a non-greedy
block match is safe), rows and cells are pulled out by regex, and the block is
emitted as a pipe table. The first row is the header whether its cells are
<th> or <td> (GFM has no headerless tables); align attributes — exactly what
MarkdownToHTML emits for GFM column alignment — map back to :--- / :---: /
---: markers; the widest row sizes the table, with narrower rows padded, so no
row is ever truncated. Cell content runs through the same inline conversions
as body text (bold, italic, code, links, strikethrough, mentions,
attachments) and block boundaries collapse to spaces.
Escaping is GFM-exact: pipes escape as \| and literal backslashes double —
GFM processes escapes left to right, so a lone \ before an escaped pipe would
swallow its backslash and turn the pipe back into a delimiter. Code spans
pass through as placeholders since backslashes are literal inside code; only
their pipes are escaped. Cell entities are fully decoded before escaping —
an encoded pipe is still a pipe, and goldmark would decode | on the
next render — and the emitted tables are parked behind placeholders until
HTMLToMarkdown's document-level unescape pass has run, so nothing
double-decodes. A goldmark-backed test proves the parsed cell content
survives the full HTML → Markdown → HTML cycle (backslash-pipe text, code
spans with pipes and backslashes, entity-encoded pipes and backslashes in
text and code, pipes in link destinations, adjacent tables), and pipe tables
round-trip byte-identical through MarkdownToHTML → HTMLToMarkdown, alignment
and the #648 blank-line separator included.
Shapes GFM can't represent still display, best-effort — colspan/rowspan cells
emit as ordinary cells, a merged grid displaying better flattened than
smeared — but editing them stays blocked: the blanket HasTableHTML gate on
the three TUI in-place editors is replaced by HasComplexTableHTML, which
fails closed on merged cells, captions, nested tables, attachments/images or
block elements inside the table, cells spanning multiple paragraphs or lines,
a table nested in a blockquote or list, unclosed tables, and tables the
converter can't extract a grid from (they'd otherwise vanish with their
content) — checking every table in the content, not just the first. Mentions are the
one rich element cells may keep: they convert to **@name** exactly as they
do in body text. Simple grids open for editing like any other content.
The mention-conversion closure moves to a named mentionMarkdown function so
cell conversion can reuse it; behavior is unchanged.
Editing simple tables in the todos view requires the composer Reset fix
(previous commit): without it, Reset dropped the description composer to
single-line mode and SetValue flattened the freshly-converted pipe table.
The todos test asserts the exact multiline table to prove the pairing.
0 commit comments