@docusaurus/plugin-content-docs 0.0.0-4675 → 0.0.0-4678
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.
|
@@ -104,6 +104,7 @@ const DefaultSidebarItemsGenerator = async ({ numberPrefixParser, isCategoryInde
|
|
|
104
104
|
function createCategoryItem(dir, fullPath, folderName) {
|
|
105
105
|
const categoryMetadata = categoriesMetadata[(0, utils_1.posixPath)(path_1.default.join(autogenDir, fullPath))];
|
|
106
106
|
const className = categoryMetadata?.className;
|
|
107
|
+
const customProps = categoryMetadata?.customProps;
|
|
107
108
|
const { filename, numberPrefix } = numberPrefixParser(folderName);
|
|
108
109
|
const allItems = Object.entries(dir).map(([key, content]) => dirToItem(content, key, `${fullPath}/${key}`));
|
|
109
110
|
// Try to match a doc inside the category folder,
|
|
@@ -149,6 +150,7 @@ const DefaultSidebarItemsGenerator = async ({ numberPrefixParser, isCategoryInde
|
|
|
149
150
|
collapsed: categoryMetadata?.collapsed,
|
|
150
151
|
position: categoryMetadata?.position ?? numberPrefix,
|
|
151
152
|
source: folderName,
|
|
153
|
+
...(customProps !== undefined && { customProps }),
|
|
152
154
|
...(className !== undefined && { className }),
|
|
153
155
|
items,
|
|
154
156
|
...(link && { link }),
|
package/lib/sidebars/types.d.ts
CHANGED
|
@@ -138,6 +138,7 @@ export declare type CategoryMetadataFile = {
|
|
|
138
138
|
collapsible?: boolean;
|
|
139
139
|
className?: string;
|
|
140
140
|
link?: SidebarItemCategoryLinkConfig | null;
|
|
141
|
+
customProps?: Record<string, unknown>;
|
|
141
142
|
};
|
|
142
143
|
export declare type SidebarItemsGeneratorDoc = Pick<DocMetadataBase, 'id' | 'unversionedId' | 'frontMatter' | 'source' | 'sourceDirName' | 'sidebarPosition'>;
|
|
143
144
|
export declare type SidebarItemsGeneratorVersion = Pick<VersionMetadata, 'versionName' | 'contentPath'>;
|
|
@@ -130,6 +130,7 @@ const categoryMetadataFileSchema = utils_validation_1.Joi.object({
|
|
|
130
130
|
collapsible: utils_validation_1.Joi.boolean(),
|
|
131
131
|
className: utils_validation_1.Joi.string(),
|
|
132
132
|
link: sidebarItemCategoryLinkSchema,
|
|
133
|
+
customProps: utils_validation_1.Joi.object().unknown(),
|
|
133
134
|
});
|
|
134
135
|
function validateCategoryMetadataFile(unsafeContent) {
|
|
135
136
|
return utils_validation_1.Joi.attempt(unsafeContent, categoryMetadataFileSchema);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-content-docs",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4678",
|
|
4
4
|
"description": "Docs plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@docusaurus/core": "0.0.0-
|
|
27
|
-
"@docusaurus/logger": "0.0.0-
|
|
28
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
29
|
-
"@docusaurus/utils": "0.0.0-
|
|
30
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
26
|
+
"@docusaurus/core": "0.0.0-4678",
|
|
27
|
+
"@docusaurus/logger": "0.0.0-4678",
|
|
28
|
+
"@docusaurus/mdx-loader": "0.0.0-4678",
|
|
29
|
+
"@docusaurus/utils": "0.0.0-4678",
|
|
30
|
+
"@docusaurus/utils-validation": "0.0.0-4678",
|
|
31
31
|
"combine-promises": "^1.1.0",
|
|
32
32
|
"fs-extra": "^10.0.1",
|
|
33
33
|
"import-fresh": "^3.3.0",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"webpack": "^5.69.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
43
|
-
"@docusaurus/types": "0.0.0-
|
|
42
|
+
"@docusaurus/module-type-aliases": "0.0.0-4678",
|
|
43
|
+
"@docusaurus/types": "0.0.0-4678",
|
|
44
44
|
"@types/js-yaml": "^4.0.5",
|
|
45
45
|
"@types/picomatch": "^2.3.0",
|
|
46
46
|
"commander": "^5.1.0",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"engines": {
|
|
57
57
|
"node": ">=14"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "553449a1da416365f1980133f6059baa57e9df50"
|
|
60
60
|
}
|
|
@@ -159,6 +159,7 @@ export const DefaultSidebarItemsGenerator: SidebarItemsGenerator = async ({
|
|
|
159
159
|
const categoryMetadata =
|
|
160
160
|
categoriesMetadata[posixPath(path.join(autogenDir, fullPath))];
|
|
161
161
|
const className = categoryMetadata?.className;
|
|
162
|
+
const customProps = categoryMetadata?.customProps;
|
|
162
163
|
const {filename, numberPrefix} = numberPrefixParser(folderName);
|
|
163
164
|
const allItems = Object.entries(dir).map(([key, content]) =>
|
|
164
165
|
dirToItem(content, key, `${fullPath}/${key}`),
|
|
@@ -219,6 +220,7 @@ export const DefaultSidebarItemsGenerator: SidebarItemsGenerator = async ({
|
|
|
219
220
|
collapsed: categoryMetadata?.collapsed,
|
|
220
221
|
position: categoryMetadata?.position ?? numberPrefix,
|
|
221
222
|
source: folderName,
|
|
223
|
+
...(customProps !== undefined && {customProps}),
|
|
222
224
|
...(className !== undefined && {className}),
|
|
223
225
|
items,
|
|
224
226
|
...(link && {link}),
|
package/src/sidebars/types.ts
CHANGED
|
@@ -216,6 +216,7 @@ export type CategoryMetadataFile = {
|
|
|
216
216
|
collapsible?: boolean;
|
|
217
217
|
className?: string;
|
|
218
218
|
link?: SidebarItemCategoryLinkConfig | null;
|
|
219
|
+
customProps?: Record<string, unknown>;
|
|
219
220
|
|
|
220
221
|
// TODO should we allow "items" here? how would this work? would an
|
|
221
222
|
// "autogenerated" type be allowed?
|
|
@@ -164,6 +164,7 @@ const categoryMetadataFileSchema = Joi.object<CategoryMetadataFile>({
|
|
|
164
164
|
collapsible: Joi.boolean(),
|
|
165
165
|
className: Joi.string(),
|
|
166
166
|
link: sidebarItemCategoryLinkSchema,
|
|
167
|
+
customProps: Joi.object().unknown(),
|
|
167
168
|
});
|
|
168
169
|
|
|
169
170
|
export function validateCategoryMetadataFile(
|