diff --git a/.dumi/remarkAntd.ts b/.dumi/remarkAntd.ts new file mode 100644 index 0000000000..85970e2c01 --- /dev/null +++ b/.dumi/remarkAntd.ts @@ -0,0 +1,12 @@ +import { unistUtilVisit } from 'dumi'; + +export default function remarkMeta() { + return (tree, vFile) => { + // read frontmatter + unistUtilVisit.visit(tree, 'yaml', (node) => { + if (!/(^|[\n\r])description:/.test(node.value)) { + vFile.data.frontmatter.__autoDescription = true; + } + }); + }; +} diff --git a/.dumi/theme/slots/Content/index.tsx b/.dumi/theme/slots/Content/index.tsx index 27ed8186d2..3e6c48388f 100644 --- a/.dumi/theme/slots/Content/index.tsx +++ b/.dumi/theme/slots/Content/index.tsx @@ -220,9 +220,7 @@ const Content: React.FC<{ children: ReactNode }> = ({ children }) => { ) : null} - {pathname.startsWith('/components') && - meta.frontmatter.description !== meta.texts[0]?.value && - meta.frontmatter.description} + {!meta.frontmatter.__autoDescription && meta.frontmatter.description} {children} {meta.frontmatter.filename && (