@docusaurus/plugin-content-docs 0.0.0-5128 → 0.0.0-5129

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/props.js CHANGED
@@ -43,10 +43,24 @@ Available document ids are:
43
43
  return undefined;
44
44
  }
45
45
  }
46
+ function getCategoryLinkCustomProps(link) {
47
+ switch (link?.type) {
48
+ case 'doc':
49
+ return getDocById(link.id).frontMatter.sidebar_custom_props;
50
+ default:
51
+ return undefined;
52
+ }
53
+ }
46
54
  function convertCategory(item) {
47
55
  const { link, ...rest } = item;
48
56
  const href = getCategoryLinkHref(link);
49
- return { ...rest, items: item.items.map(normalizeItem), ...(href && { href }) };
57
+ const customProps = item.customProps ?? getCategoryLinkCustomProps(link);
58
+ return {
59
+ ...rest,
60
+ items: item.items.map(normalizeItem),
61
+ ...(href && { href }),
62
+ ...(customProps && { customProps }),
63
+ };
50
64
  }
51
65
  function normalizeItem(item) {
52
66
  switch (item.type) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-content-docs",
3
- "version": "0.0.0-5128",
3
+ "version": "0.0.0-5129",
4
4
  "description": "Docs plugin for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "sideEffects": false,
@@ -34,13 +34,13 @@
34
34
  },
35
35
  "license": "MIT",
36
36
  "dependencies": {
37
- "@docusaurus/core": "0.0.0-5128",
38
- "@docusaurus/logger": "0.0.0-5128",
39
- "@docusaurus/mdx-loader": "0.0.0-5128",
40
- "@docusaurus/module-type-aliases": "0.0.0-5128",
41
- "@docusaurus/types": "0.0.0-5128",
42
- "@docusaurus/utils": "0.0.0-5128",
43
- "@docusaurus/utils-validation": "0.0.0-5128",
37
+ "@docusaurus/core": "0.0.0-5129",
38
+ "@docusaurus/logger": "0.0.0-5129",
39
+ "@docusaurus/mdx-loader": "0.0.0-5129",
40
+ "@docusaurus/module-type-aliases": "0.0.0-5129",
41
+ "@docusaurus/types": "0.0.0-5129",
42
+ "@docusaurus/utils": "0.0.0-5129",
43
+ "@docusaurus/utils-validation": "0.0.0-5129",
44
44
  "@types/react-router-config": "^5.0.6",
45
45
  "combine-promises": "^1.1.0",
46
46
  "fs-extra": "^10.1.0",
@@ -67,5 +67,5 @@
67
67
  "engines": {
68
68
  "node": ">=16.14"
69
69
  },
70
- "gitHead": "19486110d408838f8244019b7909fc02a7b2bdfd"
70
+ "gitHead": "4df826a4ee16cabf5865fac844f6be58bcd7a7ea"
71
71
  }
package/src/props.ts CHANGED
@@ -73,10 +73,28 @@ Available document ids are:
73
73
  }
74
74
  }
75
75
 
76
+ function getCategoryLinkCustomProps(
77
+ link: SidebarItemCategoryLink | undefined,
78
+ ) {
79
+ switch (link?.type) {
80
+ case 'doc':
81
+ return getDocById(link.id).frontMatter.sidebar_custom_props;
82
+ default:
83
+ return undefined;
84
+ }
85
+ }
86
+
76
87
  function convertCategory(item: SidebarItemCategory): PropSidebarItemCategory {
77
88
  const {link, ...rest} = item;
78
89
  const href = getCategoryLinkHref(link);
79
- return {...rest, items: item.items.map(normalizeItem), ...(href && {href})};
90
+ const customProps = item.customProps ?? getCategoryLinkCustomProps(link);
91
+
92
+ return {
93
+ ...rest,
94
+ items: item.items.map(normalizeItem),
95
+ ...(href && {href}),
96
+ ...(customProps && {customProps}),
97
+ };
80
98
  }
81
99
 
82
100
  function normalizeItem(item: SidebarItem): PropSidebarItem {