import { CheerioAPI } from '@umijs/utils/compiled/cheerio'; import { IThemeLoadResult } from 'dumi/dist/features/theme/loader'; interface Plugin { /** * The name of the plugin. */ name: string; /** * The enforced order of the plugin. */ enforce?: "pre" | "post"; /** * Modify config before it's resolved. The hook can either mutate the */ config?: (this: void, config: ConfigType) => ConfigType | null | void | Promise; /** * Use this hook to read and store the final resolved vite config. */ configResolved?: (this: void, config: ResolvedConfig) => void | Promise; /** * Modify the html before it's served. */ modifyHtml?: (this: void, html: string, cheerio: CheerioAPI) => string | Promise; /** * Modify the markdown content before load. * @param html * @param id */ modifyMarkdown?: (this: void, markdownContent: string, id: string) => Promise | string; /** * Modify the dumi theme before it's loaded. * @param theme */ modifyTheme?: (this: void, theme: IThemeLoadResult) => IThemeLoadResult | Promise; } type PluginFunctionKeys> = { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]; type PluginOption = Plugin | false | null | undefined | PluginOption[] | Promise; interface ResolvedConfig extends Required { plugins: Plugin[]; isMonorepo: boolean; } type MarkdownMeta = { /** * For configuring the title of the page, which will be used as the subtitle of the page title and the left menu. */ title?: string; /** * Controls the display order of the document, the smaller the number, the earlier the sort. */ order?: number; /** * Controls the display or hiding of the sidebar menu. */ sidemenu?: boolean; /** * For grouping the current page, so that you can group display in the sidebar menu */ group?: { /** * Group name */ title?: string; /** * Group sort, the smaller the number, the earlier the sort. */ order?: number; }; }; type ConfigType = { /** * Page Logo */ logo?: string; /** * Page Favicon */ favicon?: string; /** * Expand the html */ htmlAppend?: string; /** * Page template * @default "@vitdoc/theme-default" */ template?: string; /** * meta data file name */ metaFileName?: string | false; /** * Plugin of vitdoc */ plugins?: PluginOption[]; /** * Document directory * @default ["docs", "src"] */ docDirs?: string[]; }; export type { ConfigType as C, MarkdownMeta as M, PluginOption as P, ResolvedConfig as R, Plugin as a, PluginFunctionKeys as b };