-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
/
Copy pathplugin-content-pages.d.ts
113 lines (98 loc) · 2.98 KB
/
plugin-content-pages.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
declare module '@docusaurus/plugin-content-pages' {
import type {MDXOptions} from '@docusaurus/mdx-loader';
import type {
LoadContext,
Plugin,
OptionValidationContext,
} from '@docusaurus/types';
import type {FrontMatterLastUpdate, LastUpdateData} from '@docusaurus/utils';
export type Assets = {
image?: string;
};
export type PluginOptions = MDXOptions & {
id?: string;
path: string;
routeBasePath: string;
include: string[];
exclude: string[];
mdxPageComponent: string;
showLastUpdateTime: boolean;
showLastUpdateAuthor: boolean;
editUrl?: string | EditUrlFunction;
editLocalizedFiles?: boolean;
};
export type Options = Partial<PluginOptions>;
export type PageFrontMatter = {
readonly title?: string;
readonly description?: string;
readonly image?: string;
readonly keywords?: string[];
readonly wrapperClassName?: string;
readonly hide_table_of_contents?: string;
readonly toc_min_heading_level?: number;
readonly toc_max_heading_level?: number;
readonly draft?: boolean;
readonly unlisted?: boolean;
readonly last_update?: FrontMatterLastUpdate;
};
export type JSXPageMetadata = {
type: 'jsx';
permalink: string;
source: string;
};
export type MDXPageMetadata = LastUpdateData & {
type: 'mdx';
permalink: string;
source: string;
frontMatter: PageFrontMatter & {[key: string]: unknown};
editUrl?: string;
title?: string;
description?: string;
unlisted: boolean;
};
export type EditUrlFunction = (editUrlParams: {
/**
* The root content directory containing this post file, relative to the
* site path. Usually the same as `options.path` but can be localized
*/
pagesDirPath: string;
/** Path to this pages file, relative to `pagesDirPath`. */
pagesPath: string;
/** @see {@link PagesPostMetadata.permalink} */
permalink: string;
/** Locale name. */
locale: string;
}) => string | undefined;
export type Metadata = JSXPageMetadata | MDXPageMetadata;
export type LoadedContent = Metadata[];
export default function pluginContentPages(
context: LoadContext,
options: PluginOptions,
): Promise<Plugin<LoadedContent | null>>;
export function validateOptions(
args: OptionValidationContext<Options | undefined, PluginOptions>,
): PluginOptions;
}
declare module '@theme/MDXPage' {
import type {ReactNode} from 'react';
import type {LoadedMDXContent} from '@docusaurus/mdx-loader';
import type {
MDXPageMetadata,
PageFrontMatter,
Assets,
} from '@docusaurus/plugin-content-pages';
export interface Props {
readonly content: LoadedMDXContent<
PageFrontMatter,
MDXPageMetadata,
Assets
>;
}
export default function MDXPage(props: Props): ReactNode;
}