Introduction
@ant-design/x-markdown aims to provide a streaming-friendly, highly extensible and high-performance Markdown renderer. It offers capabilities such as streaming rendering of formulas, code highlighting, mermaid etc.
Built on marked as the base Markdown renderer, inheriting all features of marked.
<h2> for ## hi.Aligned with marked. To improve overall Markdown compatibility with systems, custom polyfills can be added.
We recommend using npm or yarn or pnpm or bun or utoo for development, which allows easy debugging in development environments and safe production deployment, enjoying the benefits of the entire ecosystem and toolchain.
$ npm install @ant-design/x-markdown --save
If your network environment is poor, we recommend using cnpm.
Include files directly in the browser using script and link tags, 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 directly, as this prevents on-demand loading and makes it difficult to get quick bug fixes for underlying dependencies.
Note:
x-markdown.js,x-markdown.min.jsandx-markdown.min.js.mapdepend onreactandreact-dom. Please ensure these are included first.
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;
@ant-design/x-markdown provides a rich set of plugins that can be used via the plugins property. See Plugin Collection for details.
@ant-design/x-markdown offers a variety of themes to choose from. See Themes for details.