Skip to content

fix(mdxish): handle lowercase <table> the same way as <Table>#1403

Open
maximilianfalco wants to merge 4 commits intonextfrom
falco/fix-rendering-difference-between-table-and-Table
Open

fix(mdxish): handle lowercase <table> the same way as <Table>#1403
maximilianfalco wants to merge 4 commits intonextfrom
falco/fix-rendering-difference-between-table-and-Table

Conversation

@maximilianfalco
Copy link
Copy Markdown
Contributor

@maximilianfalco maximilianfalco commented Mar 26, 2026

🎯 What does this PR do?

In mdxish, lowercase <table> was handled by CommonMark's HTML block type 6 parser, which fragments the block at blank lines. This caused inner markdown (blockquotes, code blocks, lists, etc.) inside <td> cells to not be parsed, and closing tags like </td> and </tr> to leak into the rendered output as visible text. The uppercase <Table> component worked fine because the jsxTable micromark tokenizer captured it as a single block before CommonMark could claim it.

This wasn't an issue in MDX because MDX treats all tags (including lowercase HTML) as JSX elements via its own tokenizer in remarkMdx

This PR does a few things:

  • Extend the jsxTable micromark tokenizer to match both <Table> and <table>, preventing fragmentation at blank lines
  • Update the mdxishTables transformer to also process lowercase <table> nodes so inner markdown is re-parsed
  • Add 13 it.each parity tests that compare the full HAST output of <table> vs <Table> using toStrictEqual

🧪 QA tips

  • Render a doc with a lowercase <table> containing a blockquote (> text) inside a <td> separated by blank lines, it should render identically to the same doc using <Table>
  • Verify that <TableRow>, <Tables>, and other Table-prefixed tags are still rejected by the tokenizer
  • Verify that <Table> inside a fenced code block is still not tokenized

This is a simple test, paste this in the demo app while viewing in both MDX and MDXish. Or use this link

<Table>
  <thead>
    <tr>
      <th>Heading</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>

> What's up

      </td>
    </tr>
  </tbody>
</Table>

---

<table>
  <thead>
    <tr>
      <th>Heading</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>

> What's up

\```                        <- remove the \ when actually testing, idk why github doesnt allow this
hello
\```

      </td>
    </tr>
  </tbody>
</table>

📸 Screenshot or Loom

Before After
Screenshot 2026-03-27 at 11 09 57 Screenshot 2026-03-27 at 11 10 58

maximilianfalco added a commit that referenced this pull request Apr 6, 2026
| 🎫 Resolve RM-15997 |
| :-----------------: |

## 🎯 What does this PR do?

Standlone `{user.` vars werent being properly parsed in`<Table>` cells.
This PR fixes that issue by allowing variable transformer to also visit
mdx flow elements

> [!NOTE]
The same issue is still happening with `<table>`. That will be solved
when this PR gets merged in: #1403

## 🧪 QA tips

```
<Table>
  <thead>
    <tr>
      <th>
        {user.name}
      </th>
      <th>
        {user.name} hello
      </th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
{user.name}
      </td>
    </tr>
  </tbody>
</Table>

| hello |
| -- |
| {user.name}|
| {user.name} hello|

{user.name}
```

## 📸 Screenshot or Loom

Before | After
-- | --
<img width="1077" height="369" alt="Screenshot 2026-04-06 at 17 48 10"
src="https://github.com/user-attachments/assets/ff1b3fcd-3ab1-4932-ae89-596aa60574c1"
/> | <img width="1079" height="372" alt="Screenshot 2026-04-06 at 17 47
49"
src="https://github.com/user-attachments/assets/9291208d-1286-4b32-af68-4485fb66eb45"
/>
rafegoldberg pushed a commit that referenced this pull request Apr 7, 2026
## Version 13.8.2
### 🛠 Fixes & Updates

* **mdxish:** handle user vars on standalone lines in tables ([#1423](#1423)) ([96dbf84](96dbf84)), closes [#1403](#1403)
* toc readme integration errors ([#1425](#1425)) ([0e769e5](0e769e5))

<!--SKIP CI-->
…o/fix-rendering-difference-between-table-and-Table
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