Skip to content

Conversation

@pepefeliblu
Copy link
Contributor

@pepefeliblu pepefeliblu commented Dec 13, 2025

  • I read the contributing guide
  • I agree to follow the code of conduct

Summary

This PR addresses an issue where copying and pasting DOM tables (e.g., from web pages) into Milkdown resulted in plain text or paragraphs instead of Markdown tables. #2159
The root cause was that the parseDOM rule for table_header_row in @milkdown/preset-gfm was too strict, requiring a data-is-header attribute. Standard HTML tables typically use <tr> elements containing <th> children for headers, without specific data attributes.

Changes:

How did you test this change?

I verified the fix by creating a local temporary reproduction test and running the full end-to-end regression suite.

  1. Local Reproduction Test (Verified & Cleaned up):
    I created a temporary test case to parse a standard HTML table string:
    <table>
      <tr>
        <th>Header 1</th>
        <th>Header 2</th>
      </tr>
      <tr>
        <td>Cell 1</td>
        <td>Cell 2</td>
      </tr>
    </table>
    Result: The parser correctly identified the structure as a table containing table_header_row and table_row.
  2. Regression Testing:
    Ran the full e2e test suite to ensure no existing functionality was broken.
    Command: pnpm --filter=@milkdown/e2e test
    Result: All 97 tests passed.

@changeset-bot
Copy link

changeset-bot bot commented Dec 13, 2025

⚠️ No Changeset found

Latest commit: 3b34b4b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Dec 13, 2025

@pepefeliblu is attempting to deploy a commit to the Milkdown Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 15, 2025

Open in StackBlitz

@milkdown/components

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/components@2206

@milkdown/core

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/core@2206

@milkdown/crepe

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/crepe@2206

@milkdown/ctx

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/ctx@2206

@milkdown/exception

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/exception@2206

@milkdown/kit

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/kit@2206

@milkdown/prose

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/prose@2206

@milkdown/transformer

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/transformer@2206

@milkdown/utils

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/utils@2206

@milkdown/react

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/react@2206

@milkdown/vue

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/vue@2206

@milkdown/plugin-automd

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/plugin-automd@2206

@milkdown/plugin-block

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/plugin-block@2206

@milkdown/plugin-clipboard

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/plugin-clipboard@2206

@milkdown/plugin-collab

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/plugin-collab@2206

@milkdown/plugin-cursor

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/plugin-cursor@2206

@milkdown/plugin-emoji

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/plugin-emoji@2206

@milkdown/plugin-highlight

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/plugin-highlight@2206

@milkdown/plugin-history

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/plugin-history@2206

@milkdown/plugin-indent

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/plugin-indent@2206

@milkdown/plugin-listener

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/plugin-listener@2206

@milkdown/plugin-prism

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/plugin-prism@2206

@milkdown/plugin-slash

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/plugin-slash@2206

@milkdown/plugin-tooltip

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/plugin-tooltip@2206

@milkdown/plugin-trailing

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/plugin-trailing@2206

@milkdown/plugin-upload

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/plugin-upload@2206

@milkdown/preset-commonmark

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/preset-commonmark@2206

@milkdown/preset-gfm

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/preset-gfm@2206

@milkdown/theme-nord

npm i https://pkg.pr.new/Milkdown/milkdown/@milkdown/theme-nord@2206

commit: 3b34b4b

@Saul-Mirone Saul-Mirone added this pull request to the merge queue Dec 15, 2025
Merged via the queue into Milkdown:main with commit 5e33ea3 Dec 15, 2025
12 of 13 checks passed
@github-actions github-actions bot mentioned this pull request Jan 5, 2026
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