@docusaurus/plugin-content-pages 0.0.0-5600 → 0.0.0-5606
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/frontMatter.d.ts +2 -2
- package/lib/frontMatter.js +6 -2
- package/lib/index.js +5 -0
- package/package.json +7 -7
- package/src/frontMatter.ts +10 -5
- package/src/index.ts +10 -0
- package/src/plugin-content-pages.d.ts +15 -4
package/lib/frontMatter.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
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
|
-
import type {
|
|
7
|
+
import type { PageFrontMatter } from '@docusaurus/plugin-content-pages';
|
|
8
8
|
export declare function validatePageFrontMatter(frontMatter: {
|
|
9
9
|
[key: string]: unknown;
|
|
10
|
-
}):
|
|
10
|
+
}): PageFrontMatter;
|
package/lib/frontMatter.js
CHANGED
|
@@ -9,8 +9,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.validatePageFrontMatter = void 0;
|
|
10
10
|
const utils_validation_1 = require("@docusaurus/utils-validation");
|
|
11
11
|
const PageFrontMatterSchema = utils_validation_1.Joi.object({
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
// See https://github.com/facebook/docusaurus/issues/4591#issuecomment-822372398
|
|
13
|
+
title: utils_validation_1.Joi.string().allow(''),
|
|
14
|
+
// See https://github.com/facebook/docusaurus/issues/4591#issuecomment-822372398
|
|
15
|
+
description: utils_validation_1.Joi.string().allow(''),
|
|
16
|
+
keywords: utils_validation_1.Joi.array().items(utils_validation_1.Joi.string().required()),
|
|
17
|
+
image: utils_validation_1.URISchema,
|
|
14
18
|
wrapperClassName: utils_validation_1.Joi.string(),
|
|
15
19
|
hide_table_of_contents: utils_validation_1.Joi.boolean(),
|
|
16
20
|
...utils_validation_1.FrontMatterTOCHeadingLevels,
|
package/lib/index.js
CHANGED
|
@@ -156,6 +156,11 @@ function pluginContentPages(context, options) {
|
|
|
156
156
|
const aliasedSource = (0, utils_1.aliasedSitePath)(mdxPath, siteDir);
|
|
157
157
|
return path_1.default.join(dataDir, `${(0, utils_1.docuHash)(aliasedSource)}.json`);
|
|
158
158
|
},
|
|
159
|
+
// Assets allow to convert some relative images paths to
|
|
160
|
+
// require(...) calls
|
|
161
|
+
createAssets: ({ frontMatter, }) => ({
|
|
162
|
+
image: frontMatter.image,
|
|
163
|
+
}),
|
|
159
164
|
markdownConfig: siteConfig.markdown,
|
|
160
165
|
},
|
|
161
166
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-content-pages",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-5606",
|
|
4
4
|
"description": "Pages plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/plugin-content-pages.d.ts",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@docusaurus/core": "0.0.0-
|
|
22
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
23
|
-
"@docusaurus/types": "0.0.0-
|
|
24
|
-
"@docusaurus/utils": "0.0.0-
|
|
25
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
21
|
+
"@docusaurus/core": "0.0.0-5606",
|
|
22
|
+
"@docusaurus/mdx-loader": "0.0.0-5606",
|
|
23
|
+
"@docusaurus/types": "0.0.0-5606",
|
|
24
|
+
"@docusaurus/utils": "0.0.0-5606",
|
|
25
|
+
"@docusaurus/utils-validation": "0.0.0-5606",
|
|
26
26
|
"fs-extra": "^11.1.0",
|
|
27
27
|
"tslib": "^2.5.0",
|
|
28
28
|
"webpack": "^5.76.0"
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": ">=16.14"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "7d506f23e3d4600b0e85eac30bb59408a8d84ed5"
|
|
38
38
|
}
|
package/src/frontMatter.ts
CHANGED
|
@@ -10,12 +10,17 @@ import {
|
|
|
10
10
|
validateFrontMatter,
|
|
11
11
|
FrontMatterTOCHeadingLevels,
|
|
12
12
|
ContentVisibilitySchema,
|
|
13
|
+
URISchema,
|
|
13
14
|
} from '@docusaurus/utils-validation';
|
|
14
|
-
import type {
|
|
15
|
+
import type {PageFrontMatter} from '@docusaurus/plugin-content-pages';
|
|
15
16
|
|
|
16
|
-
const PageFrontMatterSchema = Joi.object<
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const PageFrontMatterSchema = Joi.object<PageFrontMatter>({
|
|
18
|
+
// See https://github.com/facebook/docusaurus/issues/4591#issuecomment-822372398
|
|
19
|
+
title: Joi.string().allow(''),
|
|
20
|
+
// See https://github.com/facebook/docusaurus/issues/4591#issuecomment-822372398
|
|
21
|
+
description: Joi.string().allow(''),
|
|
22
|
+
keywords: Joi.array().items(Joi.string().required()),
|
|
23
|
+
image: URISchema,
|
|
19
24
|
wrapperClassName: Joi.string(),
|
|
20
25
|
hide_table_of_contents: Joi.boolean(),
|
|
21
26
|
...FrontMatterTOCHeadingLevels,
|
|
@@ -23,6 +28,6 @@ const PageFrontMatterSchema = Joi.object<FrontMatter>({
|
|
|
23
28
|
|
|
24
29
|
export function validatePageFrontMatter(frontMatter: {
|
|
25
30
|
[key: string]: unknown;
|
|
26
|
-
}):
|
|
31
|
+
}): PageFrontMatter {
|
|
27
32
|
return validateFrontMatter(frontMatter, PageFrontMatterSchema);
|
|
28
33
|
}
|
package/src/index.ts
CHANGED
|
@@ -31,6 +31,7 @@ import type {
|
|
|
31
31
|
PluginOptions,
|
|
32
32
|
Metadata,
|
|
33
33
|
LoadedContent,
|
|
34
|
+
PageFrontMatter,
|
|
34
35
|
} from '@docusaurus/plugin-content-pages';
|
|
35
36
|
|
|
36
37
|
export function getContentPathList(contentPaths: PagesContentPaths): string[] {
|
|
@@ -234,6 +235,15 @@ export default function pluginContentPages(
|
|
|
234
235
|
`${docuHash(aliasedSource)}.json`,
|
|
235
236
|
);
|
|
236
237
|
},
|
|
238
|
+
// Assets allow to convert some relative images paths to
|
|
239
|
+
// require(...) calls
|
|
240
|
+
createAssets: ({
|
|
241
|
+
frontMatter,
|
|
242
|
+
}: {
|
|
243
|
+
frontMatter: PageFrontMatter;
|
|
244
|
+
}) => ({
|
|
245
|
+
image: frontMatter.image,
|
|
246
|
+
}),
|
|
237
247
|
markdownConfig: siteConfig.markdown,
|
|
238
248
|
},
|
|
239
249
|
},
|
|
@@ -9,6 +9,10 @@ declare module '@docusaurus/plugin-content-pages' {
|
|
|
9
9
|
import type {MDXOptions} from '@docusaurus/mdx-loader';
|
|
10
10
|
import type {LoadContext, Plugin} from '@docusaurus/types';
|
|
11
11
|
|
|
12
|
+
export type Assets = {
|
|
13
|
+
image?: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
12
16
|
export type PluginOptions = MDXOptions & {
|
|
13
17
|
id?: string;
|
|
14
18
|
path: string;
|
|
@@ -20,9 +24,11 @@ declare module '@docusaurus/plugin-content-pages' {
|
|
|
20
24
|
|
|
21
25
|
export type Options = Partial<PluginOptions>;
|
|
22
26
|
|
|
23
|
-
export type
|
|
27
|
+
export type PageFrontMatter = {
|
|
24
28
|
readonly title?: string;
|
|
25
29
|
readonly description?: string;
|
|
30
|
+
readonly image?: string;
|
|
31
|
+
readonly keywords?: string[];
|
|
26
32
|
readonly wrapperClassName?: string;
|
|
27
33
|
readonly hide_table_of_contents?: string;
|
|
28
34
|
readonly toc_min_heading_level?: number;
|
|
@@ -41,7 +47,7 @@ declare module '@docusaurus/plugin-content-pages' {
|
|
|
41
47
|
type: 'mdx';
|
|
42
48
|
permalink: string;
|
|
43
49
|
source: string;
|
|
44
|
-
frontMatter:
|
|
50
|
+
frontMatter: PageFrontMatter & {[key: string]: unknown};
|
|
45
51
|
title?: string;
|
|
46
52
|
description?: string;
|
|
47
53
|
unlisted: boolean;
|
|
@@ -61,11 +67,16 @@ declare module '@theme/MDXPage' {
|
|
|
61
67
|
import type {LoadedMDXContent} from '@docusaurus/mdx-loader';
|
|
62
68
|
import type {
|
|
63
69
|
MDXPageMetadata,
|
|
64
|
-
|
|
70
|
+
PageFrontMatter,
|
|
71
|
+
Assets,
|
|
65
72
|
} from '@docusaurus/plugin-content-pages';
|
|
66
73
|
|
|
67
74
|
export interface Props {
|
|
68
|
-
readonly content: LoadedMDXContent<
|
|
75
|
+
readonly content: LoadedMDXContent<
|
|
76
|
+
PageFrontMatter,
|
|
77
|
+
MDXPageMetadata,
|
|
78
|
+
Assets
|
|
79
|
+
>;
|
|
69
80
|
}
|
|
70
81
|
|
|
71
82
|
export default function MDXPage(props: Props): JSX.Element;
|