@docusaurus/plugin-content-docs 3.7.0-canary-6226 → 3.7.0-canary-6230
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/client/index.d.ts +1 -0
- package/lib/client/index.js +1 -0
- package/lib/client/structuredDataUtils.d.ts +11 -0
- package/lib/client/structuredDataUtils.js +24 -0
- package/package.json +12 -11
- package/src/client/index.ts +2 -0
- package/src/client/structuredDataUtils.ts +32 -0
- package/src/plugin-content-docs.d.ts +9 -1
package/lib/client/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export { DocsSidebarProvider, useDocsSidebar } from './docsSidebar';
|
|
|
13
13
|
export { DocProvider, useDoc, type DocContextValue } from './doc';
|
|
14
14
|
export { useDocsPreferredVersionByPluginId, DocsPreferredVersionContextProvider, } from './docsPreferredVersion';
|
|
15
15
|
export { useDocsContextualSearchTags, getDocsVersionSearchTag, } from './docsSearch';
|
|
16
|
+
export { useBreadcrumbsStructuredData } from './structuredDataUtils';
|
|
16
17
|
export type ActivePlugin = {
|
|
17
18
|
pluginId: string;
|
|
18
19
|
pluginData: GlobalPluginData;
|
package/lib/client/index.js
CHANGED
|
@@ -15,6 +15,7 @@ export { DocsSidebarProvider, useDocsSidebar } from './docsSidebar';
|
|
|
15
15
|
export { DocProvider, useDoc } from './doc';
|
|
16
16
|
export { useDocsPreferredVersionByPluginId, DocsPreferredVersionContextProvider, } from './docsPreferredVersion';
|
|
17
17
|
export { useDocsContextualSearchTags, getDocsVersionSearchTag, } from './docsSearch';
|
|
18
|
+
export { useBreadcrumbsStructuredData } from './structuredDataUtils';
|
|
18
19
|
// Important to use a constant object to avoid React useEffect executions etc.
|
|
19
20
|
// see https://github.com/facebook/docusaurus/issues/5089
|
|
20
21
|
const StableEmptyObject = {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import type { PropSidebarBreadcrumbsItem } from '@docusaurus/plugin-content-docs';
|
|
8
|
+
import type { WithContext, BreadcrumbList } from 'schema-dts';
|
|
9
|
+
export declare function useBreadcrumbsStructuredData({ breadcrumbs, }: {
|
|
10
|
+
breadcrumbs: PropSidebarBreadcrumbsItem[];
|
|
11
|
+
}): WithContext<BreadcrumbList>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
8
|
+
export function useBreadcrumbsStructuredData({ breadcrumbs, }) {
|
|
9
|
+
const { siteConfig } = useDocusaurusContext();
|
|
10
|
+
return {
|
|
11
|
+
'@context': 'https://schema.org',
|
|
12
|
+
'@type': 'BreadcrumbList',
|
|
13
|
+
itemListElement: breadcrumbs
|
|
14
|
+
// We filter breadcrumb items without links, they are not allowed
|
|
15
|
+
// See also https://github.com/facebook/docusaurus/issues/9319#issuecomment-2643560845
|
|
16
|
+
.filter((breadcrumb) => breadcrumb.href)
|
|
17
|
+
.map((breadcrumb, index) => ({
|
|
18
|
+
'@type': 'ListItem',
|
|
19
|
+
position: index + 1,
|
|
20
|
+
name: breadcrumb.label,
|
|
21
|
+
item: `${siteConfig.url}${breadcrumb.href}`,
|
|
22
|
+
})),
|
|
23
|
+
};
|
|
24
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-content-docs",
|
|
3
|
-
"version": "3.7.0-canary-
|
|
3
|
+
"version": "3.7.0-canary-6230",
|
|
4
4
|
"description": "Docs plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,20 +35,21 @@
|
|
|
35
35
|
},
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@docusaurus/core": "3.7.0-canary-
|
|
39
|
-
"@docusaurus/logger": "3.7.0-canary-
|
|
40
|
-
"@docusaurus/mdx-loader": "3.7.0-canary-
|
|
41
|
-
"@docusaurus/module-type-aliases": "3.7.0-canary-
|
|
42
|
-
"@docusaurus/theme-common": "3.7.0-canary-
|
|
43
|
-
"@docusaurus/types": "3.7.0-canary-
|
|
44
|
-
"@docusaurus/utils": "3.7.0-canary-
|
|
45
|
-
"@docusaurus/utils-common": "3.7.0-canary-
|
|
46
|
-
"@docusaurus/utils-validation": "3.7.0-canary-
|
|
38
|
+
"@docusaurus/core": "3.7.0-canary-6230",
|
|
39
|
+
"@docusaurus/logger": "3.7.0-canary-6230",
|
|
40
|
+
"@docusaurus/mdx-loader": "3.7.0-canary-6230",
|
|
41
|
+
"@docusaurus/module-type-aliases": "3.7.0-canary-6230",
|
|
42
|
+
"@docusaurus/theme-common": "3.7.0-canary-6230",
|
|
43
|
+
"@docusaurus/types": "3.7.0-canary-6230",
|
|
44
|
+
"@docusaurus/utils": "3.7.0-canary-6230",
|
|
45
|
+
"@docusaurus/utils-common": "3.7.0-canary-6230",
|
|
46
|
+
"@docusaurus/utils-validation": "3.7.0-canary-6230",
|
|
47
47
|
"@types/react-router-config": "^5.0.7",
|
|
48
48
|
"combine-promises": "^1.1.0",
|
|
49
49
|
"fs-extra": "^11.1.1",
|
|
50
50
|
"js-yaml": "^4.1.0",
|
|
51
51
|
"lodash": "^4.17.21",
|
|
52
|
+
"schema-dts": "^1.1.2",
|
|
52
53
|
"tslib": "^2.6.0",
|
|
53
54
|
"utility-types": "^3.10.0",
|
|
54
55
|
"webpack": "^5.88.1"
|
|
@@ -67,5 +68,5 @@
|
|
|
67
68
|
"engines": {
|
|
68
69
|
"node": ">=18.0"
|
|
69
70
|
},
|
|
70
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "0f0362d0127756a591b2e3aefe367d3681f6b8b3"
|
|
71
72
|
}
|
package/src/client/index.ts
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
9
|
+
import type {PropSidebarBreadcrumbsItem} from '@docusaurus/plugin-content-docs';
|
|
10
|
+
import type {WithContext, BreadcrumbList} from 'schema-dts';
|
|
11
|
+
|
|
12
|
+
export function useBreadcrumbsStructuredData({
|
|
13
|
+
breadcrumbs,
|
|
14
|
+
}: {
|
|
15
|
+
breadcrumbs: PropSidebarBreadcrumbsItem[];
|
|
16
|
+
}): WithContext<BreadcrumbList> {
|
|
17
|
+
const {siteConfig} = useDocusaurusContext();
|
|
18
|
+
return {
|
|
19
|
+
'@context': 'https://schema.org',
|
|
20
|
+
'@type': 'BreadcrumbList',
|
|
21
|
+
itemListElement: breadcrumbs
|
|
22
|
+
// We filter breadcrumb items without links, they are not allowed
|
|
23
|
+
// See also https://github.com/facebook/docusaurus/issues/9319#issuecomment-2643560845
|
|
24
|
+
.filter((breadcrumb) => breadcrumb.href)
|
|
25
|
+
.map((breadcrumb, index) => ({
|
|
26
|
+
'@type': 'ListItem',
|
|
27
|
+
position: index + 1,
|
|
28
|
+
name: breadcrumb.label,
|
|
29
|
+
item: `${siteConfig.url}${breadcrumb.href}`,
|
|
30
|
+
})),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -20,7 +20,11 @@ declare module '@docusaurus/plugin-content-docs' {
|
|
|
20
20
|
TagMetadata,
|
|
21
21
|
TagsPluginOptions,
|
|
22
22
|
} from '@docusaurus/utils';
|
|
23
|
-
import type {
|
|
23
|
+
import type {
|
|
24
|
+
Plugin,
|
|
25
|
+
LoadContext,
|
|
26
|
+
OptionValidationContext,
|
|
27
|
+
} from '@docusaurus/types';
|
|
24
28
|
import type {Overwrite, Required} from 'utility-types';
|
|
25
29
|
|
|
26
30
|
export type Assets = {
|
|
@@ -559,6 +563,10 @@ declare module '@docusaurus/plugin-content-docs' {
|
|
|
559
563
|
context: LoadContext,
|
|
560
564
|
options: PluginOptions,
|
|
561
565
|
): Promise<Plugin<LoadedContent>>;
|
|
566
|
+
|
|
567
|
+
export function validateOptions(
|
|
568
|
+
args: OptionValidationContext<Options | undefined, PluginOptions>,
|
|
569
|
+
): PluginOptions;
|
|
562
570
|
}
|
|
563
571
|
|
|
564
572
|
declare module '@theme/DocItem' {
|