logoAnt Design X

DesignDevelopmentComponentsX MarkdownX SDKPlayground
  • Introduction
  • Code Examples
  • Streaming Rendering
  • Themes
  • Plugins
    • Overview
    • Latex
    • HighlightCode
    • Mermaid
    • CustomPlugins
    • Theme & Locale
  • Components
    • Think
    • DataChart
    • Custom Component

HighlightCode

Resources

Ant Design
Ant Design Charts
Ant Design Pro
Pro Components
Ant Design Mobile
Ant Design Mini
Ant Design Web3
Ant Design Landing-Landing Templates
Scaffolds-Scaffold Market
Umi-React Application Framework
dumi-Component doc generator
qiankun-Micro-Frontends Framework
Ant Motion-Motion Solution
China Mirror 🇨🇳

Community

Awesome Ant Design
Medium
Twitter
yuque logoAnt Design in YuQue
Ant Design in Zhihu
Experience Cloud Blog
seeconf logoSEE Conf-Experience Tech Conference

Help

GitHub
Change Log
FAQ
Bug Report
Issues
Discussions
StackOverflow
SegmentFault

Ant XTech logoMore Products

yuque logoYuQue-Document Collaboration Platform
AntV logoAntV-Data Visualization
Egg logoEgg-Enterprise Node.js Framework
Kitchen logoKitchen-Sketch Toolkit
Galacean logoGalacean-Interactive Graphics Solution
xtech logoAnt Financial Experience Tech
Theme Editor
Made with ❤ by
Ant Group and Ant Design Community

When to Use

When you need to render highlighted code blocks in Markdown.

Code Demo

API

PropertyDescriptionTypeDefault
langLanguagestring-
childrenCode contentstring-
headerHeader sectionReact.ReactNode | nullReact.ReactNode
classNameStyle class namestring
classNamesStyle class namesstring-
highlightPropsCode highlighting configurationhighlightProps-

Semantic DOM

Design Token

Component TokenHow to use?
Token NameDescriptionTypeDefault Value
colorBgTitleTitle background colorstringrgba(0,0,0,0.06)
colorBorderCodeCode block border colorstring#f0f0f0
colorTextTitleTitle text colorstringrgba(0,0,0,0.88)
Global TokenHow to use?
CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
typescript
import React from 'react';
import { XMarkdown } from '@ant-design/x-markdown';

const App = () => <XMarkdown content='Hello World' />;
export default App;
  • root
    root
  • header
    Wrapper element of the header
  • headerTitle
    Wrapper element of the headerTitle
  • code
    Wrapper element of the code