@docusaurus/plugin-content-docs 0.0.0-4721 → 0.0.0-4722
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/markdown/linkify.js
CHANGED
|
@@ -11,6 +11,10 @@ const versions_1 = require("../versions");
|
|
|
11
11
|
const utils_1 = require("@docusaurus/utils");
|
|
12
12
|
function getVersion(filePath, options) {
|
|
13
13
|
const versionFound = options.versionsMetadata.find((version) => (0, versions_1.getDocsDirPaths)(version).some((docsDirPath) => filePath.startsWith(docsDirPath)));
|
|
14
|
+
// At this point, this should never happen, because the MDX loaders' paths are
|
|
15
|
+
// literally using the version content paths; but if we allow sourcing content
|
|
16
|
+
// from outside the docs directory (through the `include` option, for example;
|
|
17
|
+
// is there a compelling use-case?), this would actually be testable
|
|
14
18
|
if (!versionFound) {
|
|
15
19
|
throw new Error(`Unexpected error: Markdown file at "${filePath}" does not belong to any docs version!`);
|
|
16
20
|
}
|
|
@@ -39,22 +39,17 @@ function postProcessSidebarItem(item, params) {
|
|
|
39
39
|
if (!category.link) {
|
|
40
40
|
throw new Error(`Sidebar category ${item.label} has neither any subitem nor a link. This makes this item not able to link to anything.`);
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
href: category.link.permalink,
|
|
54
|
-
};
|
|
55
|
-
default:
|
|
56
|
-
throw new Error('Unexpected sidebar category link type');
|
|
57
|
-
}
|
|
42
|
+
return category.link.type === 'doc'
|
|
43
|
+
? {
|
|
44
|
+
type: 'doc',
|
|
45
|
+
label: category.label,
|
|
46
|
+
id: category.link.id,
|
|
47
|
+
}
|
|
48
|
+
: {
|
|
49
|
+
type: 'link',
|
|
50
|
+
label: category.label,
|
|
51
|
+
href: category.link.permalink,
|
|
52
|
+
};
|
|
58
53
|
}
|
|
59
54
|
// A non-collapsible category can't be collapsed!
|
|
60
55
|
if (category.collapsible === false) {
|
package/lib/sidebars/utils.js
CHANGED
|
@@ -236,21 +236,14 @@ function toNavigationLink(navigationItem, docsById) {
|
|
|
236
236
|
if (!navigationItem) {
|
|
237
237
|
return undefined;
|
|
238
238
|
}
|
|
239
|
-
if (navigationItem.type === '
|
|
240
|
-
return
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
if (navigationItem.link.type === 'doc') {
|
|
244
|
-
return toDocNavigationLink(getDocById(navigationItem.link.id));
|
|
245
|
-
}
|
|
246
|
-
else if (navigationItem.link.type === 'generated-index') {
|
|
247
|
-
return {
|
|
239
|
+
if (navigationItem.type === 'category') {
|
|
240
|
+
return navigationItem.link.type === 'doc'
|
|
241
|
+
? toDocNavigationLink(getDocById(navigationItem.link.id))
|
|
242
|
+
: {
|
|
248
243
|
title: navigationItem.label,
|
|
249
244
|
permalink: navigationItem.link.permalink,
|
|
250
245
|
};
|
|
251
|
-
}
|
|
252
|
-
throw new Error('unexpected category link type');
|
|
253
246
|
}
|
|
254
|
-
|
|
247
|
+
return toDocNavigationLink(getDocById(navigationItem.id));
|
|
255
248
|
}
|
|
256
249
|
exports.toNavigationLink = toNavigationLink;
|
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-4722",
|
|
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-4722",
|
|
27
|
+
"@docusaurus/logger": "0.0.0-4722",
|
|
28
|
+
"@docusaurus/mdx-loader": "0.0.0-4722",
|
|
29
|
+
"@docusaurus/utils": "0.0.0-4722",
|
|
30
|
+
"@docusaurus/utils-validation": "0.0.0-4722",
|
|
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.70.0"
|
|
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-4722",
|
|
43
|
+
"@docusaurus/types": "0.0.0-4722",
|
|
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": "219b4a11069e0b5dc4c7dec07f916031001fc33b"
|
|
60
60
|
}
|
package/src/markdown/linkify.ts
CHANGED
|
@@ -15,6 +15,10 @@ function getVersion(filePath: string, options: DocsMarkdownOption) {
|
|
|
15
15
|
filePath.startsWith(docsDirPath),
|
|
16
16
|
),
|
|
17
17
|
);
|
|
18
|
+
// At this point, this should never happen, because the MDX loaders' paths are
|
|
19
|
+
// literally using the version content paths; but if we allow sourcing content
|
|
20
|
+
// from outside the docs directory (through the `include` option, for example;
|
|
21
|
+
// is there a compelling use-case?), this would actually be testable
|
|
18
22
|
if (!versionFound) {
|
|
19
23
|
throw new Error(
|
|
20
24
|
`Unexpected error: Markdown file at "${filePath}" does not belong to any docs version!`,
|
|
@@ -58,22 +58,17 @@ function postProcessSidebarItem(
|
|
|
58
58
|
`Sidebar category ${item.label} has neither any subitem nor a link. This makes this item not able to link to anything.`,
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return {
|
|
61
|
+
return category.link.type === 'doc'
|
|
62
|
+
? {
|
|
64
63
|
type: 'doc',
|
|
65
64
|
label: category.label,
|
|
66
65
|
id: category.link.id,
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return {
|
|
66
|
+
}
|
|
67
|
+
: {
|
|
70
68
|
type: 'link',
|
|
71
69
|
label: category.label,
|
|
72
70
|
href: category.link.permalink,
|
|
73
71
|
};
|
|
74
|
-
default:
|
|
75
|
-
throw new Error('Unexpected sidebar category link type');
|
|
76
|
-
}
|
|
77
72
|
}
|
|
78
73
|
// A non-collapsible category can't be collapsed!
|
|
79
74
|
if (category.collapsible === false) {
|
package/src/sidebars/utils.ts
CHANGED
|
@@ -376,18 +376,13 @@ export function toNavigationLink(
|
|
|
376
376
|
return undefined;
|
|
377
377
|
}
|
|
378
378
|
|
|
379
|
-
if (navigationItem.type === '
|
|
380
|
-
return
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
title: navigationItem.label,
|
|
387
|
-
permalink: navigationItem.link.permalink,
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
throw new Error('unexpected category link type');
|
|
379
|
+
if (navigationItem.type === 'category') {
|
|
380
|
+
return navigationItem.link.type === 'doc'
|
|
381
|
+
? toDocNavigationLink(getDocById(navigationItem.link.id))
|
|
382
|
+
: {
|
|
383
|
+
title: navigationItem.label,
|
|
384
|
+
permalink: navigationItem.link.permalink,
|
|
385
|
+
};
|
|
391
386
|
}
|
|
392
|
-
|
|
387
|
+
return toDocNavigationLink(getDocById(navigationItem.id));
|
|
393
388
|
}
|