@ant-design/x-markdown

中文文档
2.10.0发布于 2026/10/29MITTypeScriptESM + CJS近 30 天下载 14.5万

placeholder for @ant-design/x-markdown

原始使用文档
文档目录13 节
  1. ✨ Features
  2. Compatibility
  3. Supported Markdown Specs
  4. 📦 Installation
  5. Using npm, yarn, pnpm, bun, or utoo
  6. Browser Import
  7. Example
  8. Plugins
  9. Themes
  10. 🌈 Enterprise-level LLM Components Out of the Box
  11. ⚡️ Connect to Model Agents & Efficiently Manage Data Streams
  12. How to Contribute
  13. Community Support

Ant Design X Markdown

Streaming-friendly, highly extensible, and high-performance Markdown renderer

CI status codecov NPM version

NPM downloads antd Follow zhihu

Changelog · Report a Bug · Request a Feature · English · 中文

✨ Features

Uses marked as the base markdown renderer, with all features of marked.

  • 🚀 Born for speed.
  • 🤖 Streaming-friendly, LLM Markdown rendering solution.
  • ⬇️ Low-level compiler for parsing Markdown, no long-term caching or blocking.
  • ⚖️ Lightweight, implements all supported styles and markdown specs.
  • 🔐 Secure by default, no dangerouslySetInnerHTML XSS attacks.
  • 🎨 Customizable components, pass your own components to replace <h2> for ## hi.
  • 🔧 Rich plugins, many plugins available.
  • 😊 Compatible, 100% CommonMark, 100% GFM plugin support.

Compatibility

Consistent with marked. For better overall markdown compatibility, you can customize polyfills as needed.

Edge EdgeFirefox FirefoxChrome ChromeSafari SafariOpera Opera
>= 92>= 90>= 92>= 15.4>= 78

Supported Markdown Specs

📦 Installation

Using npm, yarn, pnpm, bun, or utoo

We recommend using npm, yarn, pnpm, bun, or utoo for development. This allows for easy debugging in development and safe production deployment, enjoying the benefits of the entire ecosystem and toolchain. If your network is slow, try cnpm.

npm install @ant-design/x-markdown
yarn add @ant-design/x-markdown
pnpm add @ant-design/x-markdown
ut install @ant-design/x-markdown

Browser Import

Use script and link tags to directly import files in the browser, and use the global variable XMarkdown.

We provide x-markdown.js, x-markdown.min.js, and x-markdown.min.js.map in the dist directory of the npm package.

Strongly not recommended to use built files, as this prevents on-demand loading and makes it difficult to get quick bug fixes for underlying dependency modules.

Note: x-markdown.js, x-markdown.min.js, and x-markdown.min.js.map depend on react and react-dom. Please ensure these files are imported in advance.

Example

import React from 'react';
import { XMarkdown } from '@ant-design/x-markdown';
const content = `
# Hello World

### Welcome to XMarkdown!

- Item 1
- Item 2
- Item 3
`;

const App = () => <XMarkdown content={content} />;

export default App;

Plugins

@ant-design/x-markdown provides a rich set of plugins. You can use them via the plugins prop. See Plugins Collection for details.

Themes

@ant-design/x-markdown provides several themes. See Themes for details.

🌈 Enterprise-level LLM Components Out of the Box

@ant-design/x provides a rich set of atomic components for different interaction stages based on the RICH interaction paradigm, helping you flexibly build your AI applications. See details here.

⚡️ Connect to Model Agents & Efficiently Manage Data Streams

@ant-design/x-sdk provides a set of utility APIs to help developers manage AI application data streams out of the box. See details here.

How to Contribute

Before participating in any form, please read the Contributor Guide. If you wish to contribute, feel free to submit a Pull Request or report a Bug.

We highly recommend reading How To Ask Questions The Smart Way, How to Ask Questions in Open Source Community, How to Report Bugs Effectively, and How to Submit Unanswerable Questions to Open Source Projects. Better questions are more likely to get help.

Community Support

If you encounter problems during use, you can seek help through the following channels. We also encourage experienced users to help newcomers through these channels.

When asking questions on GitHub Discussions, it is recommended to use the Q&A tag.

  1. GitHub Discussions
  2. GitHub Issues
Contribution Leaderboard

版本与发布记录

@ant-design/x-markdown 共发布 41 个版本,首次发布于 2025/08/05;过去 12 个月发布了 27 个版本。

版本发布日期距今
2.10.0latest2026/10/297 天前
2.9.02026/07/283 个月前
2.8.02026/06/084 个月前
2.7.02026/04/306 个月前
2.6.0beta2026/04/176 个月前
2.5.02026/03/317 个月前

其他发布通道:alpha → 2.0.0-alpha.16,beta → 2.6.0。

关于 @ant-design/x-markdown 的常见问题

@ant-design/x-markdown 是什么?

placeholder for @ant-design/x-markdown

如何安装 @ant-design/x-markdown?

在项目目录运行 npm install @ant-design/x-markdown,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=18.0.0)、react-dom(>=18.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@ant-design/x-markdown 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@ant-design/x-markdown 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@ant-design/x-markdown 可以商用吗?

@ant-design/x-markdown 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@ant-design/x-markdown 的下载量有多少?

根据 npm 官方下载统计,@ant-design/x-markdown 在 2026/10/06 – 2026/11/04 这 30 天内被下载 144,814 次,日均约 4,827 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ant-design/x-markdown 还在维护吗?

最新版本 2.10.0 发布于 2026/10/29(7 天前);至今共发布 41 个版本,其中过去 12 个月发布了 27 个;首次发布于 2025/08/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。