docs: fix duplicated desc (#41217)

* docs: fix duplicated desc

* fix: use remark plugin

* chore: fix ghost deps

* chore: better assign

* chore: use regexp

* chore: remove try catch
pull/41234/head^2
MadCcc 2 years ago committed by GitHub
parent d196c7a87b
commit 5c0bc214cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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;
}
});
};
}

@ -220,9 +220,7 @@ const Content: React.FC<{ children: ReactNode }> = ({ children }) => {
</Space>
</Typography.Paragraph>
) : null}
{pathname.startsWith('/components') &&
meta.frontmatter.description !== meta.texts[0]?.value &&
meta.frontmatter.description}
{!meta.frontmatter.__autoDescription && meta.frontmatter.description}
{children}
{meta.frontmatter.filename && (
<ContributorsList

@ -1,6 +1,7 @@
import { defineConfig } from 'dumi';
import path from 'path';
import rehypeAntd from './.dumi/rehypeAntd';
import remarkAntd from './.dumi/remarkAntd';
import { version } from './package.json';
export default defineConfig({
@ -33,6 +34,7 @@ export default defineConfig({
antd: require.resolve('./.dumi/theme/antd.js'),
},
extraRehypePlugins: [rehypeAntd],
extraRemarkPlugins: [remarkAntd],
extraBabelPresets: ['@emotion/babel-preset-css-prop'],
mfsu: false,
metas: [{ name: 'theme-color', content: '#1677ff' }],

Loading…
Cancel
Save