Repository navigation
fix: preserve Markdown literals in replies containing tables - #139892
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 3:53 AM ET / 07:53 UTC. ClawSweeper reviewWhat this changesPreserve surrounding Markdown and authored table-cell markup while sharing bullet and code-table layout between reply conversion and native rendering. Merge readiness✅ Ready for maintainer review The fix remains necessary: current main and v2026.9.2 still round-trip the whole message when converting tables. No actionable introduced defect was found. The maintainer-authored, protected PR should remain open. Priority: P2 Review scores
Verification
How this fits togetherMarkdown Core prepares replies for channel-specific formatters. Its table converter turns unsupported tables into bullets or code blocks before callers such as Discord format and send the reply. flowchart LR
A[Markdown reply] --> B[Existing Markdown parser]
B --> C[Table source ranges]
C --> D{Table mode}
D --> E[Bullets or code table]
A --> F[Preserved surrounding source]
E --> G[Channel formatter]
F --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -4, Tests +132. Total +128 across 4 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep table conversion source-local while preserving existing modes, native payloads, cell whitespace, and shared layout semantics. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the failure path: adding a table causes escaped text and multi-backtick code elsewhere in the reply to pass through lossy Markdown reconstruction. This review did not execute a reproduction. Is this the best way to solve the issue? Yes. Replacing parser-recognized table ranges addresses the loss at its owner while reusing established layouts and preserving unrelated source. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1594ebfcb945. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
…w#139892) * fix: preserve Markdown literals in replies containing tables * fix(markdown): type private table metadata explicitly
Additional instructions
MUST: Keep Allow edits from maintainers enabled so maintainers can help update the branch when needed.
What Problem This Solves
Fixes an issue where users reading replies with Markdown tables would see escaped literals or inline code change meaning when the table was converted to a text fallback. For example, adding a table after
Keep \*stars\* and ``a`b`` literal.could turn the stars into emphasis and break the embedded-backtick code span. Headings and blockquotes elsewhere in the same reply could also lose their formatting.Why This Change Was Made
The converter now replaces only the table ranges recognized by the existing MarkdownIt parser, preserving the original source everywhere else and retaining cell Markdown for bullet output. Native IR and Markdown fallbacks share table layout and newline emission, including the existing behavior for empty rows; the whole-message Markdown roundtrip and duplicate layout paths are removed.
User Impact
Replies containing tables retain their surrounding formatting, escaped literals and inline code. Bullet tables preserve authored cell markup and document reference links, and tables remain inside their original quote or list containers. Code-table alignment and the block-mode code fallback keep their existing behavior.
A separate pre-existing issue remains: unescaped standalone emphasis/backtick delimiters in cells can bind to generated bullet-formatting markers. That requires its own inline delimiter-ownership repair; authored escapes are preserved by this change.
Evidence
renderDiscordMarkdowncaller locally with synthetic Markdown incode,bulletsandblockmodes, then parsed the result with MarkdownIt. Escaped literals, multi-backtick code and reference links remained intact. Additional source-range checks covered nested quotes/lists, tabs, CRLF/bare CR, header-only tables and MarkdownIt's existing list-like-header recognition.1027f40156ef651e04cf733742e667ca2e974c49contains only the four reviewed files relative tof4bde51ed1c0519631efec33e8aa2bc78b1e0d38. The complete tree and owned blobs were verified; the assertion correction preserves emitted JavaScript and native payloads.Focused test command:
The formatter proof was local; no external Discord message was sent. Broad local release gates were not rerun. Hosted exact-head CI remains required before native landing.