docusaurus-plugin-typedoc 1.0.0-next.9 → 1.0.0
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/README.md +7 -284
- package/dist/index.d.ts +2 -6
- package/dist/index.js +5 -78
- package/dist/models.d.ts +3 -22
- package/dist/options/declarations.d.ts +21 -0
- package/dist/options/declarations.js +22 -0
- package/dist/options/option-types.d.ts +26 -0
- package/dist/options/option-types.js +3 -0
- package/dist/options/presets.d.ts +8 -0
- package/dist/options/presets.js +9 -0
- package/dist/options.d.ts +5 -4
- package/dist/options.js +14 -40
- package/dist/plugin.d.ts +5 -0
- package/dist/plugin.js +114 -0
- package/dist/sidebar.d.ts +2 -0
- package/dist/sidebar.js +48 -0
- package/package.json +18 -16
- package/LICENSE +0 -21
- package/dist/renderer.d.ts +0 -2
- package/dist/renderer.js +0 -85
package/README.md
CHANGED
|
@@ -1,296 +1,19 @@
|
|
|
1
1
|
# docusaurus-plugin-typedoc
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/docusaurus-plugin-typedoc) [](https://github.com/typedoc2md/typedoc-plugin-markdown/actions/workflows/ci.docusaurus-plugin-typedoc.yml)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-

|
|
7
|
-
|
|
8
|
-
## What does it do?
|
|
9
|
-
|
|
10
|
-
- Presets relevant options of [typedoc-plugin-markdown](https://github.com/tgreyuk/typedoc-plugin-markdown/tree/master/packages/typedoc-plugin-markdown#readme).
|
|
11
|
-
- Runs TypeDoc from the Docusaurus CLI.
|
|
12
|
-
- Adds some basic frontmatter to pages and exposes the ability to configure frontmatter further.
|
|
5
|
+
> A Docusaurus plugin to integrate TypeDoc ( + typedoc-plugin-markdown ) into a Docusaurus project.
|
|
13
6
|
|
|
14
7
|
## Installation
|
|
15
8
|
|
|
16
|
-
> Install [Docusaurus](https://v2.docusaurus.io/docs/installation) in the root of your project and install the plugin dependencies in the same location as the Docusaurus website directory.
|
|
17
|
-
|
|
18
|
-
> [typedoc](https://github.com/TypeStrong/typedoc), [typedoc-plugin-markdown](https://github.com/tgreyuk/typedoc-plugin-markdown) and [typedoc-plugin-frontmatter]() are required peer dependencies.
|
|
19
|
-
|
|
20
|
-
```shell
|
|
21
|
-
npm install docusaurus-plugin-typedoc typedoc typedoc-plugin-markdown@next typedoc-plugin-frontmatter@next --save-dev
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Usage
|
|
25
|
-
|
|
26
|
-
### Config
|
|
27
|
-
|
|
28
|
-
Add the plugin to `docusaurus.config.js` and specify the required options (see [options](#options)).
|
|
29
|
-
|
|
30
|
-
```js
|
|
31
|
-
module.exports = {
|
|
32
|
-
plugins: [
|
|
33
|
-
[
|
|
34
|
-
'docusaurus-plugin-typedoc',
|
|
35
|
-
|
|
36
|
-
// Plugin / TypeDoc options
|
|
37
|
-
{
|
|
38
|
-
entryPoints: ['../src/index.ts'],
|
|
39
|
-
tsconfig: '../tsconfig.json',
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
],
|
|
43
|
-
};
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
TypeDoc will be bootstraped with the Docusaurus `start` and `build` [cli commands](https://v2.docusaurus.io/docs/cli):
|
|
47
|
-
|
|
48
|
-
```javascript
|
|
49
|
-
"start": "docusaurus start",
|
|
50
|
-
"build": "docusaurus build",
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
Once built the docs will be available at `/docs/api` (or equivalent out directory).
|
|
54
|
-
|
|
55
|
-
### Directory structure
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
├── docusauruss-website
|
|
59
|
-
├── build/ (static site dir)
|
|
60
|
-
├── docs/
|
|
61
|
-
│ ├── api/ (compiled typedoc markdown)
|
|
62
|
-
├── docusaurus.config.js
|
|
63
|
-
├── package.json
|
|
64
|
-
├── sidebars.js
|
|
65
|
-
├──package.json
|
|
66
|
-
├──src (typescript source files)
|
|
67
|
-
├──tsconfig.json
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## Options
|
|
71
|
-
|
|
72
|
-
Options can be declared:
|
|
73
|
-
|
|
74
|
-
- Passing arguments via the command line.
|
|
75
|
-
- Using a `typedoc.json` file.
|
|
76
|
-
- Under the `typedocOptions` key in `tsconfig.json`.
|
|
77
|
-
|
|
78
|
-
Please see https://typedoc.org/options/configuration for general TypeDoc option configuration.
|
|
79
|
-
|
|
80
|
-
### TypeDoc options
|
|
81
|
-
|
|
82
|
-
The following TypeDoc / Markdown plugin options can be passed to config:
|
|
83
|
-
|
|
84
|
-
- [typedoc](https://typedoc.org/options) options (HTML specific output options that will be ignored).
|
|
85
|
-
- [typedoc-plugin-markdown ](https://github.com/tgreyuk/typedoc-plugin-markdown/tree/next/packages/typedoc-plugin-markdown#options) options (Some options are already preset to target Docusaurus).
|
|
86
|
-
|
|
87
|
-
The following typedoc-plugin-markdown options are preset with the plugin.
|
|
88
|
-
|
|
89
|
-
```json
|
|
90
|
-
{
|
|
91
|
-
"out": "api",
|
|
92
|
-
"hideInPageTOC": true,
|
|
93
|
-
"hideBreadcrumbs": true,
|
|
94
|
-
"hidePageHeader": true,
|
|
95
|
-
"entryDocument": "index.md",
|
|
96
|
-
"includeFileNumberPrefixes": true
|
|
97
|
-
}
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### Plugin options
|
|
101
|
-
|
|
102
|
-
Options specific to the plugin should also be declared in the same object.
|
|
103
|
-
|
|
104
|
-
#### `--sidebar`
|
|
105
|
-
|
|
106
|
-
`sidebar.autoConfiguration`
|
|
107
|
-
|
|
108
|
-
Set to `false` to disable sidebar generation. Defaults to `true`.
|
|
109
|
-
|
|
110
|
-
`sidebar.categoryLabel`
|
|
111
|
-
|
|
112
|
-
The sidebar main parent category label. Defaults to `API`.
|
|
113
|
-
|
|
114
|
-
`sidebar.indexLabel`
|
|
115
|
-
|
|
116
|
-
The label of the main index page. Please note if `readme=none` this option has no effect because the index page becomes the root page. Defaults to `Index`.
|
|
117
|
-
|
|
118
|
-
`sidebar.position`
|
|
119
|
-
|
|
120
|
-
The position of the sidebar in the tree.
|
|
121
|
-
|
|
122
|
-
#### `--docsRoot`
|
|
123
|
-
|
|
124
|
-
The Docusaurus docs folder root. Use `./` if no root folder specified. Defaults to `./docs`.
|
|
125
|
-
|
|
126
9
|
```shell
|
|
127
|
-
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### An example configuration
|
|
131
|
-
|
|
132
|
-
```js
|
|
133
|
-
module.exports = {
|
|
134
|
-
plugins: [
|
|
135
|
-
[
|
|
136
|
-
'docusaurus-plugin-typedoc',
|
|
137
|
-
{
|
|
138
|
-
// TypeDoc options
|
|
139
|
-
entryPoints: ['../src/index.ts'],
|
|
140
|
-
tsconfig: '../tsconfig.json',
|
|
141
|
-
plugin: ['typedoc-plugin-xyz'],
|
|
142
|
-
|
|
143
|
-
// Plugin options
|
|
144
|
-
out: 'api-xyz',
|
|
145
|
-
sidebar: {
|
|
146
|
-
categoryLabel: 'API XYZ',
|
|
147
|
-
position: 0,
|
|
148
|
-
fullNames: true,
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
],
|
|
153
|
-
};
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
## Frontmatter
|
|
157
|
-
|
|
158
|
-
Additional frontmatter options can be added to the config. Please see [typedoc-plugin-frontmatter](https://github.com/tgreyuk/typedoc-plugin-frontmatter#typedoc-plugin-frontmatter).
|
|
159
|
-
|
|
160
|
-
For example:
|
|
161
|
-
|
|
162
|
-
```json
|
|
163
|
-
{
|
|
164
|
-
"frontmatterGlobals": {
|
|
165
|
-
"pagination_prev": null,
|
|
166
|
-
"pagination_next": null
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
## Recipes
|
|
172
|
-
|
|
173
|
-
### Sidebar and Navbar
|
|
174
|
-
|
|
175
|
-
#### Sidebar
|
|
176
|
-
|
|
177
|
-
`sidebars.js` can be configured in following ways:
|
|
178
|
-
|
|
179
|
-
1. Generate the entire sidebar from file structure of your docs folder (default behaviour):
|
|
180
|
-
|
|
181
|
-
```js
|
|
182
|
-
module.exports = {
|
|
183
|
-
sidebar: [
|
|
184
|
-
{
|
|
185
|
-
type: 'autogenerated',
|
|
186
|
-
dirName: '.', // '.' means the docs folder
|
|
187
|
-
},
|
|
188
|
-
],
|
|
189
|
-
};
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
2. Alternatively, if you wish to manually control other parts of your sidebar you can use a slice for the TypeDoc sidebar.
|
|
193
|
-
|
|
194
|
-
> note: `sidebar.categoryLabel` and `sidebar.position` options are ignored with this implementation)
|
|
195
|
-
|
|
196
|
-
```js
|
|
197
|
-
module.exports = {
|
|
198
|
-
sidebar: {
|
|
199
|
-
'Category 1': ['doc1', 'doc2', 'doc3'],
|
|
200
|
-
API: [
|
|
201
|
-
{
|
|
202
|
-
type: 'autogenerated',
|
|
203
|
-
dirName: 'api', // 'api' is the 'out' directory
|
|
204
|
-
},
|
|
205
|
-
],
|
|
206
|
-
},
|
|
207
|
-
};
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
Please see https://docusaurus.io/docs/sidebar for sidebar documentation.
|
|
211
|
-
|
|
212
|
-
#### Navbar
|
|
213
|
-
|
|
214
|
-
A navbar item can be configured in `themeConfig` options in `docusaurus.config.js`:
|
|
215
|
-
|
|
216
|
-
```js
|
|
217
|
-
themeConfig: {
|
|
218
|
-
navbar: {
|
|
219
|
-
items: [
|
|
220
|
-
{
|
|
221
|
-
to: 'docs/api/', // 'api' is the 'out' directory
|
|
222
|
-
activeBasePath: 'docs',
|
|
223
|
-
label: 'API',
|
|
224
|
-
position: 'left',
|
|
225
|
-
},
|
|
226
|
-
],
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
Please see https://docusaurus.io/docs/api/themes/configuration#navbar-items for navbar documentation.
|
|
232
|
-
|
|
233
|
-
### Multi instance
|
|
234
|
-
|
|
235
|
-
It is possible to build multi TypeDoc instances by passing in multiple configs with unique ids:
|
|
236
|
-
|
|
237
|
-
`docusaurus.config.js`
|
|
238
|
-
|
|
239
|
-
```js
|
|
240
|
-
module.exports = {
|
|
241
|
-
plugins: [
|
|
242
|
-
[
|
|
243
|
-
'docusaurus-plugin-typedoc',
|
|
244
|
-
{
|
|
245
|
-
id: 'api-1',
|
|
246
|
-
entryPoints: ['../api-1/src/index.ts'],
|
|
247
|
-
tsconfig: '../api-1/tsconfig.json',
|
|
248
|
-
out: 'api-1',
|
|
249
|
-
},
|
|
250
|
-
],
|
|
251
|
-
[
|
|
252
|
-
'docusaurus-plugin-typedoc',
|
|
253
|
-
{
|
|
254
|
-
id: 'api-2',
|
|
255
|
-
entryPoints: ['../api-2/src/index.ts'],
|
|
256
|
-
tsconfig: '../api-2/tsconfig.json',
|
|
257
|
-
out: 'api-2',
|
|
258
|
-
},
|
|
259
|
-
],
|
|
260
|
-
],
|
|
261
|
-
};
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
### Watch mode
|
|
265
|
-
|
|
266
|
-
Watching files is supported by passing in the `watch: true` option see [https://typedoc.org/guides/options/#watch](https://typedoc.org/guides/options/#watch).
|
|
267
|
-
|
|
268
|
-
Targetting the option in development mode only can be achieved using Node.js Environment Variables:
|
|
269
|
-
|
|
270
|
-
`package.json`
|
|
271
|
-
|
|
272
|
-
```json
|
|
273
|
-
"start": "TYPEDOC_WATCH=true docusaurus start",
|
|
274
|
-
"build": "TYPEDOC_WATCH=false docusaurus build",
|
|
275
|
-
```
|
|
10
|
+
npm install docusaurus-plugin-typedoc --save-dev
|
|
11
|
+
```
|
|
276
12
|
|
|
277
|
-
|
|
13
|
+
## Documentation
|
|
278
14
|
|
|
279
|
-
|
|
280
|
-
module.exports = {
|
|
281
|
-
plugins: [
|
|
282
|
-
[
|
|
283
|
-
'docusaurus-plugin-typedoc',
|
|
284
|
-
{
|
|
285
|
-
entryPoints: ['../src/index.ts'],
|
|
286
|
-
tsconfig: '../tsconfig.json',
|
|
287
|
-
watch: process.env.TYPEDOC_WATCH,
|
|
288
|
-
},
|
|
289
|
-
],
|
|
290
|
-
],
|
|
291
|
-
};
|
|
292
|
-
```
|
|
15
|
+
Please visit the [https://typedoc-plugin-markdown.org/plugins/docusaurus](https://typedoc-plugin-markdown.org/plugins/docusaurus) for comprehensive documentation, including options and usage guides.
|
|
293
16
|
|
|
294
17
|
## License
|
|
295
18
|
|
|
296
|
-
|
|
19
|
+
MIT
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export default
|
|
3
|
-
name: string;
|
|
4
|
-
loadContent(): Promise<void>;
|
|
5
|
-
extendCli(cli: any): void;
|
|
6
|
-
};
|
|
1
|
+
export { PluginOptions } from './models';
|
|
2
|
+
export { default } from './plugin';
|
package/dist/index.js
CHANGED
|
@@ -1,81 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
4
|
};
|
|
25
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const renderer_1 = require("./renderer");
|
|
30
|
-
const apps = [];
|
|
31
|
-
function pluginDocusaurus(context, opts) {
|
|
32
|
-
return {
|
|
33
|
-
name: 'docusaurus-plugin-typedoc',
|
|
34
|
-
async loadContent() {
|
|
35
|
-
if (opts.id && !apps.includes(opts.id)) {
|
|
36
|
-
apps.push(opts.id);
|
|
37
|
-
generateTypedoc(context, opts);
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
extendCli(cli) {
|
|
41
|
-
cli
|
|
42
|
-
.command('generate-typedoc')
|
|
43
|
-
.description('(docusaurus-plugin-typedoc) Generate TypeDoc docs independently of the Docusaurus build process.')
|
|
44
|
-
.action(async () => {
|
|
45
|
-
var _a;
|
|
46
|
-
(_a = context.siteConfig) === null || _a === void 0 ? void 0 : _a.plugins.forEach((pluginConfig) => {
|
|
47
|
-
if (pluginConfig && typeof pluginConfig[1] === 'object') {
|
|
48
|
-
generateTypedoc(context, pluginConfig[1]);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
exports.default = pluginDocusaurus;
|
|
56
|
-
async function generateTypedoc(context, opts) {
|
|
57
|
-
const { siteDir } = context;
|
|
58
|
-
const options = (0, options_1.getPluginOptions)(opts);
|
|
59
|
-
const { id, docsRoot, ...optionsPassedToTypeDoc } = options;
|
|
60
|
-
const outputDir = path.resolve(siteDir, options.docsRoot, options.out);
|
|
61
|
-
const app = new typedoc_1.Application();
|
|
62
|
-
(0, options_1.loadOptions)(app);
|
|
63
|
-
(0, renderer_1.loadRenderer)(app);
|
|
64
|
-
await app.bootstrapWithPlugins(optionsPassedToTypeDoc);
|
|
65
|
-
const project = app.convert();
|
|
66
|
-
if (!project) {
|
|
67
|
-
if (app.options.getValue('skipErrorChecking')) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
console.error('[docusaurus-plugin-typedoc] TypeDoc exited with an error. Use the "skipErrorChecking" option to disable TypeDoc error checking.');
|
|
71
|
-
process.exit();
|
|
72
|
-
}
|
|
73
|
-
if (options.watch) {
|
|
74
|
-
app.convertAndWatch(async (project) => {
|
|
75
|
-
await app.generateDocs(project, outputDir);
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
await app.generateDocs(project, outputDir);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var plugin_1 = require("./plugin");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(plugin_1).default; } });
|
package/dist/models.d.ts
CHANGED
|
@@ -1,24 +1,5 @@
|
|
|
1
|
-
import { TypedocPluginMarkdownOptions } from 'typedoc-plugin-markdown';
|
|
2
|
-
|
|
1
|
+
import { PluginOptions as TypedocPluginMarkdownOptions } from 'typedoc-plugin-markdown';
|
|
2
|
+
import { PluginOptions as DocusaurusOptions } from './options/option-types';
|
|
3
|
+
export interface PluginOptions extends TypedocPluginMarkdownOptions, DocusaurusOptions {
|
|
3
4
|
id: string;
|
|
4
|
-
docsRoot: string;
|
|
5
|
-
sidebar: SidebarOptions;
|
|
6
5
|
}
|
|
7
|
-
export interface SidebarOptions {
|
|
8
|
-
categoryLabel: string;
|
|
9
|
-
position: number | null;
|
|
10
|
-
autoConfiguration: boolean;
|
|
11
|
-
indexLabel: string;
|
|
12
|
-
}
|
|
13
|
-
export interface SidebarCategory {
|
|
14
|
-
type: string;
|
|
15
|
-
label: string;
|
|
16
|
-
items: SidebarItem[];
|
|
17
|
-
}
|
|
18
|
-
export interface CategoryYamlOptions {
|
|
19
|
-
path: string;
|
|
20
|
-
label: string;
|
|
21
|
-
position: number | null;
|
|
22
|
-
collapsed: boolean;
|
|
23
|
-
}
|
|
24
|
-
export type SidebarItem = SidebarCategory | string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ParameterType } from 'typedoc';
|
|
2
|
+
/**
|
|
3
|
+
* **sidebar.autoConfiguration**
|
|
4
|
+
*
|
|
5
|
+
* Set to `false` to disable sidebar generation. Defaults to `true`.
|
|
6
|
+
*
|
|
7
|
+
* **sidebar.pretty**
|
|
8
|
+
*
|
|
9
|
+
* Pretty format the sidebar JSON.
|
|
10
|
+
*
|
|
11
|
+
* Please see the [sidebar guide](/plugins/docusaurus/guide/sidebar) for additional information on sidebar setup.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
export declare const sidebar: {
|
|
15
|
+
help: string;
|
|
16
|
+
type: ParameterType;
|
|
17
|
+
defaultValue: {
|
|
18
|
+
autoConfiguration: boolean;
|
|
19
|
+
pretty: boolean;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sidebar = void 0;
|
|
4
|
+
const typedoc_1 = require("typedoc");
|
|
5
|
+
const options_1 = require("../options");
|
|
6
|
+
/**
|
|
7
|
+
* **sidebar.autoConfiguration**
|
|
8
|
+
*
|
|
9
|
+
* Set to `false` to disable sidebar generation. Defaults to `true`.
|
|
10
|
+
*
|
|
11
|
+
* **sidebar.pretty**
|
|
12
|
+
*
|
|
13
|
+
* Pretty format the sidebar JSON.
|
|
14
|
+
*
|
|
15
|
+
* Please see the [sidebar guide](/plugins/docusaurus/guide/sidebar) for additional information on sidebar setup.
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
exports.sidebar = {
|
|
19
|
+
help: 'Configures the autogenerated Docusaurus sidebar.',
|
|
20
|
+
type: typedoc_1.ParameterType.Mixed,
|
|
21
|
+
defaultValue: options_1.DEFAULT_SIDEBAR_OPTIONS,
|
|
22
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ManuallyValidatedOption } from 'typedoc';
|
|
2
|
+
declare module 'typedoc' {
|
|
3
|
+
interface TypeDocOptionMap {
|
|
4
|
+
sidebar: ManuallyValidatedOption<Sidebar>;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Describes the options declared by the plugin.
|
|
9
|
+
*
|
|
10
|
+
* @category Options
|
|
11
|
+
*/
|
|
12
|
+
export interface PluginOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Configures the autogenerated Docusaurus sidebar.
|
|
15
|
+
*/
|
|
16
|
+
sidebar: Sidebar;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
* @category Options
|
|
22
|
+
*/
|
|
23
|
+
export interface Sidebar {
|
|
24
|
+
autoConfiguration: boolean;
|
|
25
|
+
pretty: boolean;
|
|
26
|
+
}
|
package/dist/options.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export declare const DEFAULT_SIDEBAR_OPTIONS: {
|
|
2
|
+
autoConfiguration: boolean;
|
|
3
|
+
pretty: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare function getPluginOptions(opts: Record<string, any>): Record<string, any>;
|
package/dist/options.js
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
6
|
+
exports.getPluginOptions = exports.DEFAULT_SIDEBAR_OPTIONS = void 0;
|
|
7
|
+
const presets_1 = __importDefault(require("./options/presets"));
|
|
8
|
+
exports.DEFAULT_SIDEBAR_OPTIONS = {
|
|
9
|
+
autoConfiguration: true,
|
|
10
|
+
pretty: false,
|
|
11
|
+
};
|
|
5
12
|
const DEFAULT_PLUGIN_OPTIONS = {
|
|
13
|
+
...presets_1.default,
|
|
6
14
|
id: 'default',
|
|
7
|
-
docsRoot: 'docs',
|
|
8
|
-
out: 'api',
|
|
9
|
-
watch: false,
|
|
10
|
-
plugin: [],
|
|
11
|
-
hideInPageTOC: true,
|
|
12
|
-
hideBreadcrumbs: true,
|
|
13
|
-
hidePageHeader: true,
|
|
14
|
-
includeFileNumberPrefixes: true,
|
|
15
15
|
sidebar: {
|
|
16
|
-
|
|
17
|
-
position: null,
|
|
18
|
-
autoConfiguration: true,
|
|
19
|
-
indexLabel: 'Index',
|
|
16
|
+
...exports.DEFAULT_SIDEBAR_OPTIONS,
|
|
20
17
|
},
|
|
21
18
|
};
|
|
22
19
|
function getPluginOptions(opts) {
|
|
@@ -27,33 +24,10 @@ function getPluginOptions(opts) {
|
|
|
27
24
|
...DEFAULT_PLUGIN_OPTIONS.sidebar,
|
|
28
25
|
...opts.sidebar,
|
|
29
26
|
},
|
|
27
|
+
plugin: [
|
|
28
|
+
...new Set([...DEFAULT_PLUGIN_OPTIONS.plugin, ...(opts.plugin || [])]),
|
|
29
|
+
],
|
|
30
30
|
};
|
|
31
31
|
return options;
|
|
32
32
|
}
|
|
33
33
|
exports.getPluginOptions = getPluginOptions;
|
|
34
|
-
function loadOptions(app) {
|
|
35
|
-
app.options.addReader(new typedoc_1.PackageJsonReader());
|
|
36
|
-
app.options.addReader(new typedoc_1.TypeDocReader());
|
|
37
|
-
app.options.addReader(new typedoc_1.TSConfigReader());
|
|
38
|
-
app.options.addDeclaration({
|
|
39
|
-
name: 'sidebar',
|
|
40
|
-
type: typedoc_1.ParameterType.Mixed,
|
|
41
|
-
});
|
|
42
|
-
app.options.addReader(new (class {
|
|
43
|
-
constructor() {
|
|
44
|
-
this.name = 'docusaurus-options';
|
|
45
|
-
this.order = 900;
|
|
46
|
-
this.supportsPackages = false;
|
|
47
|
-
}
|
|
48
|
-
read(container) {
|
|
49
|
-
const plugins = container.getValue('plugin');
|
|
50
|
-
['typedoc-plugin-markdown', 'typedoc-plugin-frontmatter'].forEach((defaultPlugin) => {
|
|
51
|
-
if (!plugins.includes(defaultPlugin)) {
|
|
52
|
-
plugins.push(defaultPlugin);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
container.setValue('plugin', plugins);
|
|
56
|
-
}
|
|
57
|
-
})());
|
|
58
|
-
}
|
|
59
|
-
exports.loadOptions = loadOptions;
|
package/dist/plugin.d.ts
ADDED
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const fs = __importStar(require("fs"));
|
|
27
|
+
const path = __importStar(require("path"));
|
|
28
|
+
const typedoc_1 = require("typedoc");
|
|
29
|
+
const options_1 = require("./options");
|
|
30
|
+
const options = __importStar(require("./options/declarations"));
|
|
31
|
+
const sidebar_1 = require("./sidebar");
|
|
32
|
+
// store list of plugin ids when running multiple instances
|
|
33
|
+
const apps = [];
|
|
34
|
+
async function pluginDocusaurus(context, opts) {
|
|
35
|
+
const PLUGIN_NAME = 'docusaurus-plugin-typedoc';
|
|
36
|
+
if (opts.id && !apps.includes(opts.id)) {
|
|
37
|
+
apps.push(opts.id);
|
|
38
|
+
await generateTypedoc(context, opts);
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
name: PLUGIN_NAME,
|
|
42
|
+
extendCli(cli) {
|
|
43
|
+
cli
|
|
44
|
+
.command('generate-typedoc')
|
|
45
|
+
.description(`[${PLUGIN_NAME}] Generate TypeDoc docs independently of the Docusaurus build process.`)
|
|
46
|
+
.action(async () => {
|
|
47
|
+
context.siteConfig?.plugins.forEach((pluginConfig) => {
|
|
48
|
+
// Check PluginConfig is typed to [string, PluginOptions]
|
|
49
|
+
if (pluginConfig && typeof pluginConfig[1] === 'object') {
|
|
50
|
+
generateTypedoc(context, pluginConfig[1]);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
exports.default = pluginDocusaurus;
|
|
58
|
+
/**
|
|
59
|
+
* Initiates a new typedoc Application bootstrapped with plugin options
|
|
60
|
+
*/
|
|
61
|
+
async function generateTypedoc(context, opts) {
|
|
62
|
+
const { siteDir } = context;
|
|
63
|
+
const pluginOptions = (0, options_1.getPluginOptions)(opts);
|
|
64
|
+
const { id, sidebar, ...optionsPassedToTypeDoc } = pluginOptions;
|
|
65
|
+
const app = await typedoc_1.Application.bootstrapWithPlugins(optionsPassedToTypeDoc);
|
|
66
|
+
Object.entries(options).forEach(([name, option]) => {
|
|
67
|
+
app.options.addDeclaration({
|
|
68
|
+
name,
|
|
69
|
+
...option,
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
// attempt to handle docusaurus linkify bug https://github.com/facebook/docusaurus/issues/9048
|
|
73
|
+
app.renderer.on(typedoc_1.PageEvent.END, (event) => {
|
|
74
|
+
event.contents = event.contents
|
|
75
|
+
?.replace(/\)\.\[/g, ') . [')
|
|
76
|
+
.replace(/\\<\[/g, ' \\<[');
|
|
77
|
+
});
|
|
78
|
+
const outputDir = app.options.getValue('out');
|
|
79
|
+
if (sidebar?.autoConfiguration) {
|
|
80
|
+
const docsPreset = context.siteConfig?.presets?.find((preset) => Boolean(preset[1]?.docs));
|
|
81
|
+
app.renderer.postRenderAsyncJobs.push(async (output) => {
|
|
82
|
+
if (output.navigation) {
|
|
83
|
+
const sidebarPath = path.resolve(outputDir, 'typedoc-sidebar.cjs');
|
|
84
|
+
const baseDir = path
|
|
85
|
+
.relative(siteDir, outputDir)
|
|
86
|
+
.split(path.sep)
|
|
87
|
+
.slice(1)
|
|
88
|
+
.join(path.sep);
|
|
89
|
+
const sidebarJson = (0, sidebar_1.getSidebar)(output.navigation, baseDir, docsPreset ? docsPreset[1]?.docs?.numberPrefixParser : null);
|
|
90
|
+
fs.writeFileSync(sidebarPath, `// @ts-check
|
|
91
|
+
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
|
92
|
+
const typedocSidebar = { items: ${JSON.stringify(sidebarJson, null, sidebar.pretty ? 2 : 0)}};
|
|
93
|
+
module.exports = typedocSidebar.items;`);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
const project = await app.convert();
|
|
98
|
+
// if project is undefined typedoc has a problem - error logging will be supplied by typedoc.
|
|
99
|
+
if (!project) {
|
|
100
|
+
if (app.options.getValue('skipErrorChecking')) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
console.error('[docusaurus-plugin-typedoc] TypeDoc exited with an error. Use the "skipErrorChecking" option to disable TypeDoc error checking.');
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
if (app.options.getValue('watch')) {
|
|
107
|
+
app.convertAndWatch(async (project) => {
|
|
108
|
+
await app.generateDocs(project, outputDir);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
await app.generateDocs(project, outputDir);
|
|
113
|
+
}
|
|
114
|
+
}
|
package/dist/sidebar.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSidebar = void 0;
|
|
4
|
+
function getSidebar(navigation, basePath, numberPrefixParser) {
|
|
5
|
+
return navigation
|
|
6
|
+
.map((navigationItem) => getNavigationItem(navigationItem, basePath, numberPrefixParser))
|
|
7
|
+
.filter((navItem) => Boolean(navItem));
|
|
8
|
+
}
|
|
9
|
+
exports.getSidebar = getSidebar;
|
|
10
|
+
function getNavigationItem(navigationItem, basePath, numberPrefixParser) {
|
|
11
|
+
const parsedUrl = numberPrefixParser === false
|
|
12
|
+
? navigationItem.path
|
|
13
|
+
: navigationItem.path?.replace(/\d+\-/g, '');
|
|
14
|
+
const getId = () => {
|
|
15
|
+
const idParts = [];
|
|
16
|
+
if (basePath.length > 0) {
|
|
17
|
+
idParts.push(basePath);
|
|
18
|
+
}
|
|
19
|
+
if (parsedUrl) {
|
|
20
|
+
idParts.push(parsedUrl.replace(/\\/g, '/'));
|
|
21
|
+
}
|
|
22
|
+
if (navigationItem.path) {
|
|
23
|
+
return idParts.join('/').replace(/(.*)\.\w+$/, '$1');
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
};
|
|
27
|
+
const id = getId();
|
|
28
|
+
if (navigationItem.children?.length) {
|
|
29
|
+
return {
|
|
30
|
+
type: 'category',
|
|
31
|
+
label: `${navigationItem.title}`,
|
|
32
|
+
items: getSidebar(navigationItem.children, basePath, numberPrefixParser),
|
|
33
|
+
...(id && {
|
|
34
|
+
link: {
|
|
35
|
+
type: 'doc',
|
|
36
|
+
id,
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return id
|
|
42
|
+
? {
|
|
43
|
+
type: 'doc',
|
|
44
|
+
id,
|
|
45
|
+
label: `${navigationItem.title}`,
|
|
46
|
+
}
|
|
47
|
+
: null;
|
|
48
|
+
}
|
package/package.json
CHANGED
|
@@ -1,39 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-plugin-typedoc",
|
|
3
|
-
"version": "1.0.0
|
|
4
|
-
"description": "A Docusaurus
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A Docusaurus plugin to integrate TypeDoc ( + typedoc-plugin-markdown ) into a Docusaurus project.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist/"
|
|
8
8
|
],
|
|
9
9
|
"bugs": {
|
|
10
|
-
"url": "https://github.com/
|
|
10
|
+
"url": "https://github.com/typedoc2md/typedoc-plugin-markdown/issues"
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "git+https://github.com/
|
|
14
|
+
"url": "git+https://github.com/typedoc2md/typedoc-plugin-markdown.git",
|
|
15
15
|
"directory": "packages/docusaurus-plugin-typedoc"
|
|
16
16
|
},
|
|
17
|
-
"homepage": "
|
|
17
|
+
"homepage": "http://typedoc.org/plugins/docusaurus",
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"typedoc-plugin-
|
|
20
|
-
"typedoc-plugin-markdown": ">=4.0.0-next.11"
|
|
19
|
+
"typedoc-plugin-markdown": ">=4.0.0"
|
|
21
20
|
},
|
|
22
21
|
"scripts": {
|
|
23
22
|
"lint": "eslint ./src --ext .ts",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"build
|
|
27
|
-
"
|
|
23
|
+
"prebuild": "rm -rf dist && prebuild-options",
|
|
24
|
+
"prepublishOnly": "npm run lint && npm run build",
|
|
25
|
+
"build": "tsc",
|
|
26
|
+
"pretest": "rm -rf ./test/out && docusaurus generate-typedoc",
|
|
27
|
+
"test": "jest",
|
|
28
|
+
"test:update": "npm run build && npm test -- -u"
|
|
28
29
|
},
|
|
29
30
|
"author": "Thomas Grey",
|
|
30
31
|
"license": "MIT",
|
|
31
32
|
"keywords": [
|
|
32
33
|
"docusaurus",
|
|
33
34
|
"typedoc",
|
|
34
|
-
"plugin"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
35
|
+
"plugin"
|
|
36
|
+
],
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@docusaurus/core": "^3.2.1",
|
|
39
|
+
"@docusaurus/types": "^3.2.1"
|
|
40
|
+
}
|
|
39
41
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2016 Thomas Grey
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/dist/renderer.d.ts
DELETED
package/dist/renderer.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.loadRenderer = void 0;
|
|
4
|
-
const typedoc_1 = require("typedoc");
|
|
5
|
-
const typedoc_plugin_frontmatter_1 = require("typedoc-plugin-frontmatter");
|
|
6
|
-
function loadRenderer(app) {
|
|
7
|
-
app.renderer.on(typedoc_1.PageEvent.END, (page) => {
|
|
8
|
-
if (page.contents) {
|
|
9
|
-
page.contents = page.contents.replace(/\\</g, '<');
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
app.renderer.on(typedoc_plugin_frontmatter_1.FrontmatterEvent.PREPARE_FRONTMATTER, (event) => {
|
|
13
|
-
loadFrontmatter(app, event);
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
exports.loadRenderer = loadRenderer;
|
|
17
|
-
function loadFrontmatter(app, event) {
|
|
18
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
19
|
-
const renderContext = app.renderer.theme.getRenderContext();
|
|
20
|
-
const hasReadme = !app.options.getValue('readme').endsWith('none');
|
|
21
|
-
const sidebar = app.options.getValue('sidebar');
|
|
22
|
-
const isModulesPage = (_a = event.page) === null || _a === void 0 ? void 0 : _a.url.endsWith(renderContext.modulesFile);
|
|
23
|
-
const isIndexPage = (_b = event.page) === null || _b === void 0 ? void 0 : _b.url.endsWith(renderContext.indexFile);
|
|
24
|
-
const isReadmePage = (_c = event.page) === null || _c === void 0 ? void 0 : _c.url.endsWith(renderContext.readmeFile);
|
|
25
|
-
const isPackageModule = event.page.model.kindOf(typedoc_1.ReflectionKind.Module) &&
|
|
26
|
-
!Boolean(((_d = event.page.model) === null || _d === void 0 ? void 0 : _d.parent).groups);
|
|
27
|
-
const model = (_e = event.page) === null || _e === void 0 ? void 0 : _e.model;
|
|
28
|
-
let pluginFrontmatter = {};
|
|
29
|
-
if (sidebar.autoConfiguration) {
|
|
30
|
-
if (!isModulesPage && !isReadmePage) {
|
|
31
|
-
const sidebarLabel = !model.kindOf(typedoc_1.ReflectionKind.Module) &&
|
|
32
|
-
!app.options.getValue('hideKindTag') &&
|
|
33
|
-
app.options.getValue('excludeGroups')
|
|
34
|
-
? `(${Array.from(typedoc_1.ReflectionKind.singularString(model.kind))[0]}) ${model === null || model === void 0 ? void 0 : model.name}`
|
|
35
|
-
: model === null || model === void 0 ? void 0 : model.name;
|
|
36
|
-
pluginFrontmatter = {
|
|
37
|
-
...pluginFrontmatter,
|
|
38
|
-
sidebar_label: sidebarLabel,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
if (((_f = event.page) === null || _f === void 0 ? void 0 : _f.url) === renderContext.readmeFile ||
|
|
42
|
-
(!hasReadme && isModulesPage)) {
|
|
43
|
-
if (sidebar.categoryLabel) {
|
|
44
|
-
pluginFrontmatter = {
|
|
45
|
-
...pluginFrontmatter,
|
|
46
|
-
sidebar_label: sidebar.categoryLabel,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
if (sidebar.position !== null && !Number.isNaN(sidebar.position)) {
|
|
50
|
-
pluginFrontmatter = {
|
|
51
|
-
...pluginFrontmatter,
|
|
52
|
-
sidebar_position: sidebar.position,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
if (isModulesPage) {
|
|
57
|
-
pluginFrontmatter = {
|
|
58
|
-
...pluginFrontmatter,
|
|
59
|
-
sidebar_label: sidebar.indexLabel,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
if (isPackageModule && isReadmePage) {
|
|
63
|
-
pluginFrontmatter = {
|
|
64
|
-
...pluginFrontmatter,
|
|
65
|
-
sidebar_label: event.page.model.name,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
if (isPackageModule && isIndexPage && Boolean((_g = event.page.model) === null || _g === void 0 ? void 0 : _g.readme)) {
|
|
69
|
-
pluginFrontmatter = {
|
|
70
|
-
...pluginFrontmatter,
|
|
71
|
-
sidebar_label: sidebar.indexLabel,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
if (isPackageModule && isIndexPage && !Boolean((_h = event.page.model) === null || _h === void 0 ? void 0 : _h.readme)) {
|
|
75
|
-
pluginFrontmatter = {
|
|
76
|
-
...pluginFrontmatter,
|
|
77
|
-
sidebar_label: event.page.model.name,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
event.frontmatter = {
|
|
82
|
-
...pluginFrontmatter,
|
|
83
|
-
...event.frontmatter,
|
|
84
|
-
};
|
|
85
|
-
}
|