docusaurus-plugin-typedoc 1.0.0-next.4 → 1.0.0-next.5
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/dist/navigation.d.ts +0 -2
- package/dist/navigation.js +1 -23
- package/dist/theme.d.ts +2 -2
- package/dist/theme.js +9 -4
- package/package.json +2 -2
package/dist/navigation.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ReflectionKind } from 'typedoc';
|
|
2
1
|
export declare const CATEGORY_POSITION: {
|
|
3
2
|
2: number;
|
|
4
3
|
4: number;
|
|
@@ -10,4 +9,3 @@ export declare const CATEGORY_POSITION: {
|
|
|
10
9
|
64: number;
|
|
11
10
|
2097152: number;
|
|
12
11
|
};
|
|
13
|
-
export declare function getKindPlural(kind: ReflectionKind): string;
|
package/dist/navigation.js
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CATEGORY_POSITION = void 0;
|
|
4
4
|
const typedoc_1 = require("typedoc");
|
|
5
|
-
const PLURALS = {
|
|
6
|
-
[typedoc_1.ReflectionKind.Class]: 'Classes',
|
|
7
|
-
[typedoc_1.ReflectionKind.Property]: 'Properties',
|
|
8
|
-
[typedoc_1.ReflectionKind.Enum]: 'Enumerations',
|
|
9
|
-
[typedoc_1.ReflectionKind.EnumMember]: 'Enumeration members',
|
|
10
|
-
[typedoc_1.ReflectionKind.Namespace]: 'Namespaces',
|
|
11
|
-
[typedoc_1.ReflectionKind.TypeAlias]: 'Type aliases',
|
|
12
|
-
};
|
|
13
5
|
exports.CATEGORY_POSITION = {
|
|
14
6
|
[typedoc_1.ReflectionKind.Module]: 1,
|
|
15
7
|
[typedoc_1.ReflectionKind.Namespace]: 1,
|
|
@@ -21,17 +13,3 @@ exports.CATEGORY_POSITION = {
|
|
|
21
13
|
[typedoc_1.ReflectionKind.Function]: 7,
|
|
22
14
|
[typedoc_1.ReflectionKind.ObjectLiteral]: 8,
|
|
23
15
|
};
|
|
24
|
-
function getKindPlural(kind) {
|
|
25
|
-
if (kind in PLURALS) {
|
|
26
|
-
return PLURALS[kind];
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
return getKindString(kind) + 's';
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.getKindPlural = getKindPlural;
|
|
33
|
-
function getKindString(kind) {
|
|
34
|
-
let str = typedoc_1.ReflectionKind[kind];
|
|
35
|
-
str = str.replace(/(.)([A-Z])/g, (_m, a, b) => a + ' ' + b.toLowerCase());
|
|
36
|
-
return str;
|
|
37
|
-
}
|
package/dist/theme.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ export declare class DocusaurusTheme extends MarkdownTheme {
|
|
|
6
6
|
constructor(renderer: Renderer);
|
|
7
7
|
onPageEnd(page: PageEvent<DeclarationReflection>): void;
|
|
8
8
|
onRendererEnd(renderer: RendererEvent): void;
|
|
9
|
-
loopAndWriteCategories(path: string): void;
|
|
10
|
-
writeCategoryYaml: (categoryPath: string, label: string, position: number | null, collapsed: boolean) => void;
|
|
9
|
+
loopAndWriteCategories(path: string, level?: number): void;
|
|
10
|
+
writeCategoryYaml: (categoryPath: string, label: string, position: number | null, collapsed: boolean, generatedIndex: boolean) => void;
|
|
11
11
|
}
|
package/dist/theme.js
CHANGED
|
@@ -37,7 +37,7 @@ const navigation_1 = require("./navigation");
|
|
|
37
37
|
class DocusaurusTheme extends typedoc_plugin_markdown_1.MarkdownTheme {
|
|
38
38
|
constructor(renderer) {
|
|
39
39
|
super(renderer);
|
|
40
|
-
this.writeCategoryYaml = (categoryPath, label, position, collapsed) => {
|
|
40
|
+
this.writeCategoryYaml = (categoryPath, label, position, collapsed, generatedIndex) => {
|
|
41
41
|
const yaml = [`label: "${label}"`];
|
|
42
42
|
if (position !== null) {
|
|
43
43
|
yaml.push(`position: ${position}`);
|
|
@@ -45,6 +45,11 @@ class DocusaurusTheme extends typedoc_plugin_markdown_1.MarkdownTheme {
|
|
|
45
45
|
if (!collapsed) {
|
|
46
46
|
yaml.push(`collapsed: false`);
|
|
47
47
|
}
|
|
48
|
+
if (generatedIndex) {
|
|
49
|
+
yaml.push(`link:
|
|
50
|
+
type: "generated-index"
|
|
51
|
+
title: "${label}"`);
|
|
52
|
+
}
|
|
48
53
|
if (fs.existsSync(categoryPath)) {
|
|
49
54
|
fs.writeFileSync(categoryPath + '/_category_.yml', yaml.join('\n'));
|
|
50
55
|
}
|
|
@@ -61,7 +66,7 @@ class DocusaurusTheme extends typedoc_plugin_markdown_1.MarkdownTheme {
|
|
|
61
66
|
}
|
|
62
67
|
onRendererEnd(renderer) {
|
|
63
68
|
if (this.sidebar.autoConfiguration) {
|
|
64
|
-
this.writeCategoryYaml(renderer.outputDirectory, this.sidebar.categoryLabel, this.sidebar.position, this.sidebar.collapsed);
|
|
69
|
+
this.writeCategoryYaml(renderer.outputDirectory, this.sidebar.categoryLabel, this.sidebar.position, this.sidebar.collapsed, false);
|
|
65
70
|
this.loopAndWriteCategories(renderer.outputDirectory);
|
|
66
71
|
const globalsFile = this.getRenderContext().globalsFile;
|
|
67
72
|
const globalsPath = `${renderer.outputDirectory}/${this.getRenderContext().globalsFile}`;
|
|
@@ -70,7 +75,7 @@ class DocusaurusTheme extends typedoc_plugin_markdown_1.MarkdownTheme {
|
|
|
70
75
|
}
|
|
71
76
|
}
|
|
72
77
|
}
|
|
73
|
-
loopAndWriteCategories(path) {
|
|
78
|
+
loopAndWriteCategories(path, level = 0) {
|
|
74
79
|
const directory = fs.readdirSync(path);
|
|
75
80
|
directory.forEach((segment) => {
|
|
76
81
|
const fullPath = `${path}/${segment}`;
|
|
@@ -85,7 +90,7 @@ class DocusaurusTheme extends typedoc_plugin_markdown_1.MarkdownTheme {
|
|
|
85
90
|
const containsDir = subdirectory.some((item) => fs.lstatSync(`${fullPath}/${item}`).isDirectory());
|
|
86
91
|
if ((mapping && !containsDir) ||
|
|
87
92
|
(mapping === null || mapping === void 0 ? void 0 : mapping.kind) === typedoc_1.ReflectionKind.Namespace) {
|
|
88
|
-
this.writeCategoryYaml(fullPath,
|
|
93
|
+
this.writeCategoryYaml(fullPath, typedoc_1.ReflectionKind.pluralString(mapping.kind), navigation_1.CATEGORY_POSITION[mapping.kind], true, true);
|
|
89
94
|
}
|
|
90
95
|
this.loopAndWriteCategories(fullPath);
|
|
91
96
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-plugin-typedoc",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.5",
|
|
4
4
|
"description": "A Docusaurus v2 plugin to build API documentation with TypeDoc.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"homepage": "https://github.com/tgreyuk/typedoc-plugin-markdown/tree/master/packages/docusaurus-plugin-typedoc",
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"typedoc-plugin-markdown": ">=4.0.0-next.
|
|
19
|
+
"typedoc-plugin-markdown": ">=4.0.0-next.6"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"lint": "eslint ./src --ext .ts",
|