Skip to content

fix(mdxish): honor backslash escaped list and hash markers in JSX table cells#1497

Draft
maximilianfalco wants to merge 2 commits into
nextfrom
falco/rm-16838-lone-rendered-as-bullet-list-in-html-table-and-table-cells
Draft

fix(mdxish): honor backslash escaped list and hash markers in JSX table cells#1497
maximilianfalco wants to merge 2 commits into
nextfrom
falco/rm-16838-lone-rendered-as-bullet-list-in-html-table-and-table-cells

Conversation

@maximilianfalco
Copy link
Copy Markdown
Contributor

@maximilianfalco maximilianfalco commented May 29, 2026

🎫 Resolve RM-16838

🎯 What does this PR do?

Two fixes inside <table> and <Table> cells in mdxish-tables.ts:

1. Honor single-backslash escapes for block markers

\-, \*, \+, \# now render as literal text. Previously you needed two backslashes.

Why it was broken: mdxish-tables.ts double-parses cell content. The first pass (outer mdxjs) consumes the \ correctly per CommonMark, leaving the resolved marker as text. The second pass (processTableNode's re-parse for gemoji / variables / bold / etc.) sees the bare marker at the start of a fresh document and re-tokenises it as a list / heading.

Fix: before the second parse, peek at the cell's original source. If it started with \-/\*/\+/\#, re-prepend the \ so the inner parser honors the escape the same way the outer one did.

2. Flatten standalone block markers to literal text

A lone -/*/+/#/>/---/*** in a cell — common in header rows — used to render as an empty bullet list, empty heading, empty blockquote, or <hr>. Now it renders as the literal character.

Why it was broken: the inner re-parse takes any single character that could start a CommonMark block and tokenises it that way, even when there's no content after — producing <ul><li></li></ul> for <td>-</td> and similar nonsense for the other markers.

Fix: after the re-parse, if the result is a phantom empty block (empty list-item, empty heading, empty blockquote, thematic break), replace it with the user's original text. Blocks with real content (- foo, # heading, > quote) are untouched.

🧪 QA tips

Use this in the demo app

<table>
<thead><tr><th>#</th><th>-</th><th>-</th></tr></thead>
<tbody><tr><td>- fqefeq</td><td>- hello</td><td>-</td></tr></tbody>
</table>

<table>
<thead><tr><th>-</th><th>-</th><th>-</th></tr></thead>
<tbody><tr><td>- fqefeq</td><td>- hello</td><td>-</td></tr></tbody>
</table>

<Table>
  <thead>
    <tr><th>-</th><th>-</th><th>-</th></tr>
  </thead>
  <tbody>
    <tr><td>- fqefeq</td><td>- hello</td><td>-</td></tr>
  </tbody>
</Table>

| - | - |
| --- | --- |
| - fqefeq | - hello |
| - | - |
  • previously you needed 2 backslashes to escape the - and #, now with the fix, you only need 1 which is the expected behaviour
  • standalone - / # / > / --- cells render as literal text instead of empty bullets / headings / blockquotes / <hr>
  • - foo / # heading / > quote still render as proper lists / headings / blockquotes (default markdown)

📸 Screenshot or Loom

Screen.Recording.2026-05-29.at.20.35.33.mov

@maximilianfalco maximilianfalco marked this pull request as draft May 29, 2026 13:45
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.

1 participant