fix(mdxish): honor backslash escaped list and hash markers in JSX table cells#1497
Draft
maximilianfalco wants to merge 2 commits into
Draft
Conversation
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.
🎯 What does this PR do?
Two fixes inside
<table>and<Table>cells inmdxish-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.tsdouble-parses cell content. The first pass (outermdxjs) 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
-and#, now with the fix, you only need 1 which is the expected behaviour-/#/>/---cells render as literal text instead of empty bullets / headings / blockquotes /<hr>- foo/# heading/> quotestill render as proper lists / headings / blockquotes (default markdown)📸 Screenshot or Loom
Screen.Recording.2026-05-29.at.20.35.33.mov