Skip to content

fix: preserve literal HTML in Markdown table exports - #618

Merged
farnabaz merged 4 commits into
vercel:mainfrom
lllleolin-max:lllleolin-max/fix-markdown-table-literals
Sep 15, 2026
Merged

farnabaz merged 4 commits into
vercel:mainfrom
lllleolin-max:lllleolin-max/fix-markdown-table-literals

Conversation

@lllleolin-max

Copy link
Copy Markdown
Contributor

Description

Copying or downloading a table as Markdown can change its cell text when the export is rendered again. For example, Array<string> becomes Array, and the literal text &copy; becomes ©.

Escape &, <, and > in the shared Markdown cell serializer so those values survive export. The existing single-pass serializer still emits <br> for actual newlines.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Changes Made

  • Preserve literal HTML and character entities in Markdown table exports, including headers.
  • Add a DOM → Markdown → DOM regression test using the existing marked dependency.
  • Add a patch changeset for streamdown.

Testing

  • Added new tests for the changes
  • All existing tests in the changed package pass: pnpm --filter streamdown test — 85 files, 1,173 tests.
  • Confirmed the new regression fails on the original serializer and passes with the fix (47 table utility tests).
  • pnpm -r --filter 'streamdown...' build — core and dependency packages build, including declarations.
  • pnpm check — 291 files checked.
  • Manually tested the changes

An extra pnpm --filter streamdown exec tsc --noEmit check reports 211 existing diagnostics on both the original and patched source; diagnostics match after normalizing source positions. This check is not passing on the baseline either.

Checklist

  • My code follows the project's code style
  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective
  • New and existing unit tests in the changed package pass locally
  • I have created a changeset

Changeset

  • I have created a changeset for these changes

Additional Notes

Prepared with OpenAI Codex. Automated tests and Codex agent review were completed; no independent human review is claimed.

@vercel

vercel Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

@lllleolin-max is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@farnabaz
farnabaz force-pushed the lllleolin-max/fix-markdown-table-literals branch from f4707a0 to 0cbcfb6 Compare September 15, 2026 08:39
lllleolin-max and others added 4 commits September 15, 2026 10:40
Escape HTML-sensitive characters in table cell text and verify DOM-to-Markdown round trips.

Assisted-by: OpenAI GPT-6 <noreply@openai.com>
Add direct expects for Array<string>, &copy;, literal a<br>b, and mixed &/<>.
Keep the original marked DOM round-trip and add a duplicate fixture through
Streamdown's Markdown path (remark-gfm + rehype-raw).
Capture the pre-existing limitation that bold, code, and links still
re-interpret when exported table Markdown is rendered again.
@farnabaz
farnabaz force-pushed the lllleolin-max/fix-markdown-table-literals branch from 0cbcfb6 to 1abac05 Compare September 15, 2026 08:41

@farnabaz farnabaz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@farnabaz
farnabaz merged commit 5504e50 into vercel:main Sep 15, 2026
6 of 7 checks passed
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.

2 participants