diff --git a/components/tag/__tests__/__snapshots__/demo.test.js.snap b/components/tag/__tests__/__snapshots__/demo.test.js.snap index 63fd13dd4adc..b51ad16407d7 100644 --- a/components/tag/__tests__/__snapshots__/demo.test.js.snap +++ b/components/tag/__tests__/__snapshots__/demo.test.js.snap @@ -232,12 +232,17 @@ Array [ `; exports[`renders ./components/tag/demo/colorful.md correctly 1`] = ` -
- + + Presets + +
,
purple -
-

, +

+ + Custom + + ,
#108ee9 -
- + , +] `; exports[`renders ./components/tag/demo/control.md correctly 1`] = ` diff --git a/components/tag/demo/colorful.md b/components/tag/demo/colorful.md index 6e6489a07896..828424e4bc9f 100644 --- a/components/tag/demo/colorful.md +++ b/components/tag/demo/colorful.md @@ -14,11 +14,11 @@ title: We preset a series of colorful tag styles for use in different situations. You can also set it to a hex color string for custom color. ```jsx -import { Tag } from 'antd'; +import { Tag, Divider } from 'antd'; ReactDOM.render( -
-

Presets:

+ <> + Presets
magenta red @@ -32,14 +32,14 @@ ReactDOM.render( geekblue purple
-

Custom:

+ Custom
#f50 #2db7f5 #87d068 #108ee9
-
, + , mountNode, ); ``` diff --git a/site/theme/template/Content/Demo/index.jsx b/site/theme/template/Content/Demo/index.jsx index f8471099358f..85c6d5cdf698 100644 --- a/site/theme/template/Content/Demo/index.jsx +++ b/site/theme/template/Content/Demo/index.jsx @@ -181,10 +181,7 @@ class Demo extends React.Component { html, js: sourceCode .replace(/import\s+{(\s+[^}]*\s+)}\s+from\s+'antd';/, 'const { $1 } = antd;') - .replace( - /import\s+{(\s+[^}]*\s+)}\s+from\s+'@ant-design\/icons';/, - 'const { $1 } = icons;', - ) + .replace(/import\s+{(\s+[^}]*\s+)}\s+from\s+'@ant-design\/icons';/, 'const { $1 } = icons;') .replace("import moment from 'moment';", '') .replace(/import\s+{\s+(.*)\s+}\s+from\s+'react-router';/, 'const { $1 } = ReactRouter;') .replace( @@ -252,7 +249,11 @@ import 'antd/dist/antd.css'; import './index.css'; ${parsedSourceCode.replace('mountNode', "document.getElementById('container')")} `.trim(); - const indexCssContent = (style || '').replace(new RegExp(`#${meta.id}\\s*`, 'g'), ''); + const indexCssContent = (style || '') + .trim() + .replace(new RegExp(`#${meta.id}\\s*`, 'g'), '') + .replace('', '') + .replace('