Theme and copy
Use XProvider as the global copy of the plug-in; the highlight/Mermaid appearance can follow the ant-design-vue Design Token, or be customized through the component styles / classNames.
Usage notes
XProvider inherits ConfigProvider of ant-design-vue and provides global configuration for ant-design-x-vue components (including Markdown plug-in copywriting). If the project is already using ConfigProvider, please change it to:
diff
- import { ConfigProvider } from 'ant-design-vue';
+ import { XProvider } from 'ant-design-x-vue';
const App = () => (
- <ConfigProvider>
+ <XProvider>
<YourApp />
- </ConfigProvider>
+ </XProvider>
);Merge the language package of ant-design-vue with the zh_CN / en_US of ant-design-x-vue and pass it to locale. The "Copy" of HighlightCode and the toolbar copy of Mermaid will be switched accordingly.
Examples
Internationalization
Change locale of components:
```ts
export const answer = 42;
```
```mermaid
quadrantChart
title Reach and engagement
x-axis Low Reach --> High Reach
y-axis Low Engagement --> High Engagement
quadrant-1 Expand
quadrant-2 Promote
quadrant-3 Re-evaluate
quadrant-4 Improve
Campaign A: [0.3, 0.6]
Campaign B: [0.45, 0.23]
```Theme colors
Header fill (colorFillContent):
Here's a Python example:
pythondef fibonacci(n): if n <= 1: return n a, b = 0, 1 for _ in range(2, n + 1): a, b = b, a + b return b print(fibonacci(10))
Related
- Component-level API:
styles/classNamesSee HighlightCode, Mermaid - Markdown body light / dark CSS: theme
- XProvider full API: XProvider