Skip to content

chore(x-markdown-deps): bump marked from 15.x to 16.x - #1969

Open
waiter wants to merge 6 commits into
ant-design:mainfrom
waiter:upgrade_marked
Open

chore(x-markdown-deps): bump marked from 15.x to 16.x#1969
waiter wants to merge 6 commits into
ant-design:mainfrom
waiter:upgrade_marked

Conversation

@waiter

@waiter waiter commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

中文版模板 / Chinese template

🤔 This is a ...

  • 🆕 New feature
  • 🐞 Bug fix
  • 📝 Site / documentation improvement
  • 📽️ Demo improvement
  • 💄 Component style improvement
  • 🤖 TypeScript definition improvement
  • 📦 Bundle size optimization
  • ⚡️ Performance optimization
  • ⭐️ Feature enhancement
  • 🌐 Internationalization
  • 🛠 Refactoring
  • 🎨 Code style optimization
  • ✅ Test Case
  • 🔀 Branch merge
  • ⏩ Workflow
  • ⌨️ Accessibility improvement
  • ❓ Other (about what?)

🔗 Related Issues

💡 Background and Solution

由于 x 依赖了 mermaid ,而 mermaid 又依赖 marked 16.x ,但是当前 x-markdown 依赖的 marked 是 15.x ,所以在同时使用 两者时,marked 会被打包 2 次

📝 Change Log

Language Changelog
🇺🇸 English bump x-markdown deps marked from 15.x to 16.x
🇨🇳 Chinese 将 x-markdown 的 marked 依赖从 15.x 升级到 16.x

Summary by CodeRabbit

  • Bug Fixes
    • 修复 Markdown 渲染尾部挂载位置:当内容以引用定义结尾(如 [foo]: ...),尾部仍会正确附加到最后一个可见文本段落内。
  • Tests
    • 新增 streaming 场景用例,断言末尾为引用定义时最后段落内包含 .xmd-tail
  • Chores
    • 升级 Markdown 解析依赖版本,以提升对新输入格式的兼容性。

@dosubot dosubot Bot added the dependencies Pull requests that update a dependency file label Jul 9, 2026
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 60749156-a48b-46d1-acc2-62264346bb73

📥 Commits

Reviewing files that changed from the base of the PR and between 65bc821 and ebba717.

📒 Files selected for processing (1)
  • packages/x-markdown/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/x-markdown/package.json

📝 Walkthrough

Walkthrough

将 x-markdown 的 marked 依赖升级到 ^16.2.1,更新 Jest 模块转换范围,并新增流式渲染测试,验证引用定义结尾时 tail 仍挂载在最后可见文本段落中。

Changes

marked 依赖升级与测试验证

Layer / File(s) Summary
依赖、配置与测试
packages/x-markdown/package.json, packages/x/.jest.js, packages/x-markdown/src/XMarkdown/__tests__/index.test.tsx
更新 marked 版本,补充 Jest 对 marked 的 transform 配置,并新增 streaming 用例验证末尾引用定义场景下 .xmd-tail 的挂载位置。

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: javascript

Suggested reviewers: div627

Poem

我是小兔蹦蹦跳,marked 换上新外套;
尾巴稳稳进段落,引用定义不捣乱。
Jest 转换排整齐,测试通过胡萝卜香。 🐰

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了本次将 marked 从 15.x 升级到 16.x 的主要变更,且与 x-markdown 相关。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request upgrades the marked dependency from ^15.0.12 to ^16.2.1 in packages/x-markdown, which updates snapshot tests for the LaTeX plugin and introduces a new test case to ensure the streaming tail renders correctly when content ends with a reference definition. The reviewer suggested improving the robustness of this new test case by asserting that paragraph elements exist before accessing them, preventing potential unhandled TypeError exceptions during test failures.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +774 to +777
const paragraphs = container.querySelectorAll('p');
const lastParagraph = paragraphs[paragraphs.length - 1];
const tailElement = lastParagraph.querySelector('.xmd-tail');
expect(tailElement).toBeInTheDocument();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

在测试中,如果 paragraphs 为空,paragraphs[paragraphs.length - 1] 将会是 undefined,这会导致 lastParagraph.querySelector 抛出 TypeError 异常,从而掩盖了实际的测试断言失败。建议先断言 paragraphs 存在且长度大于 0,或者使用可选链(optional chaining)来提高测试的健壮性,使测试失败时的错误信息更加清晰。

    const paragraphs = container.querySelectorAll('p');
    expect(paragraphs.length).toBeGreaterThan(0);
    const lastParagraph = paragraphs[paragraphs.length - 1];
    const tailElement = lastParagraph?.querySelector('.xmd-tail');
    expect(tailElement).toBeInTheDocument();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 8 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
antdx-array-push 2.11MB 8 bytes (0.0%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: antdx-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
antdx.min.js 8 bytes 2.11MB 0.0%

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.06%. Comparing base (13afbf4) to head (ebba717).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1969   +/-   ##
=======================================
  Coverage   97.06%   97.06%           
=======================================
  Files         159      159           
  Lines        5766     5766           
  Branches     1712     1710    -2     
=======================================
  Hits         5597     5597           
  Misses        167      167           
  Partials        2        2           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Div627

Div627 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

@waiter marked 15.x --> 16.x 会有 breaking change 嘛?

@waiter

waiter commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

@waiter marked 15.x --> 16.x 会有 breaking change 嘛?

@Div627 有打包相关的 breaking change : https://github.com/markedjs/marked/releases/tag/v16.0.0
image

另外,让 AI 整理的 版本变化对比:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants