Skip to content

Latest commit

 

History

History
146 lines (96 loc) · 7.55 KB

File metadata and controls

146 lines (96 loc) · 7.55 KB

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 Edge Firefox Firefox Chrome Chrome Safari Safari Opera 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