@docusaurus/plugin-content-pages 2.0.0-beta.15d451942 → 2.0.0-beta.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +4 -3
- package/lib/index.js +41 -51
- package/lib/markdownLoader.d.ts +2 -6
- package/lib/markdownLoader.js +3 -3
- package/{src/__tests__/__fixtures__/website/src/pages/hello/translatedJs.js → lib/pageFrontMatter.d.ts} +2 -8
- package/lib/pageFrontMatter.js +21 -0
- package/lib/pluginOptionSchema.d.ts +1 -1
- package/lib/pluginOptionSchema.js +8 -5
- package/lib/types.d.ts +1 -21
- package/package.json +13 -14
- package/{types.d.ts → src/deps.d.ts} +0 -0
- package/src/index.ts +51 -66
- package/src/markdownLoader.ts +7 -10
- package/src/pageFrontMatter.ts +27 -0
- package/src/plugin-content-pages.d.ts +51 -12
- package/src/pluginOptionSchema.ts +4 -6
- package/src/types.ts +1 -25
- package/lib/.tsbuildinfo +0 -4393
- package/src/__tests__/__fixtures__/website/docusaurus.config.js +0 -14
- package/src/__tests__/__fixtures__/website/i18n/fr/docusaurus-plugin-content-pages/hello/translatedJs.js +0 -14
- package/src/__tests__/__fixtures__/website/i18n/fr/docusaurus-plugin-content-pages/hello/translatedMd.md +0 -1
- package/src/__tests__/__fixtures__/website/src/pages/hello/_ignore.js +0 -1
- package/src/__tests__/__fixtures__/website/src/pages/hello/_ignore.md +0 -1
- package/src/__tests__/__fixtures__/website/src/pages/hello/_ignore.mdx +0 -1
- package/src/__tests__/__fixtures__/website/src/pages/hello/_ignore.tsx +0 -1
- package/src/__tests__/__fixtures__/website/src/pages/hello/index.md +0 -2
- package/src/__tests__/__fixtures__/website/src/pages/hello/mdxPage.mdx +0 -5
- package/src/__tests__/__fixtures__/website/src/pages/hello/translatedMd.md +0 -1
- package/src/__tests__/__fixtures__/website/src/pages/hello/world.js +0 -22
- package/src/__tests__/__fixtures__/website/src/pages/index.js +0 -23
- package/src/__tests__/__fixtures__/website/src/pages/typescript.tsx +0 -22
- package/src/__tests__/index.test.ts +0 -139
- package/src/__tests__/pluginOptionSchema.test.ts +0 -54
- package/tsconfig.json +0 -9
|
@@ -5,24 +5,63 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
declare module '@docusaurus/plugin-content-pages' {
|
|
9
|
+
import type {RemarkAndRehypePluginOptions} from '@docusaurus/mdx-loader';
|
|
10
|
+
|
|
11
|
+
export type PluginOptions = RemarkAndRehypePluginOptions & {
|
|
12
|
+
id?: string;
|
|
13
|
+
path: string;
|
|
14
|
+
routeBasePath: string;
|
|
15
|
+
include: string[];
|
|
16
|
+
exclude: string[];
|
|
17
|
+
mdxPageComponent: string;
|
|
18
|
+
admonitions: Record<string, unknown>;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type Options = Partial<PluginOptions>;
|
|
22
|
+
|
|
23
|
+
export type FrontMatter = {
|
|
24
|
+
readonly title?: string;
|
|
25
|
+
readonly description?: string;
|
|
26
|
+
readonly wrapperClassName?: string;
|
|
27
|
+
readonly hide_table_of_contents?: string;
|
|
28
|
+
readonly toc_min_heading_level?: number;
|
|
29
|
+
readonly toc_max_heading_level?: number;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type JSXPageMetadata = {
|
|
33
|
+
type: 'jsx';
|
|
34
|
+
permalink: string;
|
|
35
|
+
source: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type MDXPageMetadata = {
|
|
39
|
+
type: 'mdx';
|
|
40
|
+
permalink: string;
|
|
41
|
+
source: string;
|
|
42
|
+
frontMatter: FrontMatter & Record<string, unknown>;
|
|
43
|
+
title?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type Metadata = JSXPageMetadata | MDXPageMetadata;
|
|
48
|
+
}
|
|
49
|
+
|
|
8
50
|
declare module '@theme/MDXPage' {
|
|
9
51
|
import type {TOCItem} from '@docusaurus/types';
|
|
52
|
+
import type {
|
|
53
|
+
MDXPageMetadata,
|
|
54
|
+
FrontMatter,
|
|
55
|
+
} from '@docusaurus/plugin-content-pages';
|
|
10
56
|
|
|
11
|
-
export
|
|
57
|
+
export interface Props {
|
|
12
58
|
readonly content: {
|
|
13
|
-
readonly frontMatter:
|
|
14
|
-
|
|
15
|
-
readonly description: string;
|
|
16
|
-
readonly wrapperClassName?: string;
|
|
17
|
-
// eslint-disable-next-line camelcase
|
|
18
|
-
readonly hide_table_of_contents?: string;
|
|
19
|
-
};
|
|
20
|
-
readonly metadata: {readonly permalink: string};
|
|
59
|
+
readonly frontMatter: FrontMatter;
|
|
60
|
+
readonly metadata: MDXPageMetadata;
|
|
21
61
|
readonly toc: readonly TOCItem[];
|
|
22
62
|
(): JSX.Element;
|
|
23
63
|
};
|
|
24
|
-
}
|
|
64
|
+
}
|
|
25
65
|
|
|
26
|
-
|
|
27
|
-
export default MDXPage;
|
|
66
|
+
export default function MDXPage(props: Props): JSX.Element;
|
|
28
67
|
}
|
|
@@ -4,29 +4,27 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
import type {PluginOptions} from '@docusaurus/plugin-content-pages';
|
|
8
9
|
import {
|
|
9
10
|
Joi,
|
|
10
11
|
RemarkPluginsSchema,
|
|
11
12
|
RehypePluginsSchema,
|
|
12
13
|
AdmonitionsSchema,
|
|
13
14
|
} from '@docusaurus/utils-validation';
|
|
15
|
+
import {GlobExcludeDefault} from '@docusaurus/utils';
|
|
14
16
|
|
|
15
17
|
export const DEFAULT_OPTIONS: PluginOptions = {
|
|
16
18
|
path: 'src/pages', // Path to data on filesystem, relative to site dir.
|
|
17
19
|
routeBasePath: '/', // URL Route.
|
|
18
20
|
include: ['**/*.{js,jsx,ts,tsx,md,mdx}'], // Extensions to include.
|
|
21
|
+
exclude: GlobExcludeDefault,
|
|
19
22
|
mdxPageComponent: '@theme/MDXPage',
|
|
20
23
|
remarkPlugins: [],
|
|
21
24
|
rehypePlugins: [],
|
|
22
25
|
beforeDefaultRehypePlugins: [],
|
|
23
26
|
beforeDefaultRemarkPlugins: [],
|
|
24
27
|
admonitions: {},
|
|
25
|
-
exclude: [
|
|
26
|
-
'**/_*.{js,jsx,ts,tsx,md,mdx}',
|
|
27
|
-
'**/*.test.{js,ts}',
|
|
28
|
-
'**/__tests__/**',
|
|
29
|
-
],
|
|
30
28
|
};
|
|
31
29
|
|
|
32
30
|
export const PluginOptionSchema = Joi.object({
|
package/src/types.ts
CHANGED
|
@@ -5,31 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type {
|
|
9
|
-
|
|
10
|
-
export interface PluginOptions extends RemarkAndRehypePluginOptions {
|
|
11
|
-
id?: string;
|
|
12
|
-
path: string;
|
|
13
|
-
routeBasePath: string;
|
|
14
|
-
include: string[];
|
|
15
|
-
exclude: string[];
|
|
16
|
-
mdxPageComponent: string;
|
|
17
|
-
admonitions: Record<string, unknown>;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export type JSXPageMetadata = {
|
|
21
|
-
type: 'jsx';
|
|
22
|
-
permalink: string;
|
|
23
|
-
source: string;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export type MDXPageMetadata = {
|
|
27
|
-
type: 'mdx';
|
|
28
|
-
permalink: string;
|
|
29
|
-
source: string;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export type Metadata = JSXPageMetadata | MDXPageMetadata;
|
|
8
|
+
import type {Metadata} from '@docusaurus/plugin-content-pages';
|
|
33
9
|
|
|
34
10
|
export type LoadedContent = Metadata[];
|
|
35
11
|
|