docusaurus-plugin-typedoc 0.16.4 → 0.16.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/README.md +29 -34
- package/dist/options.js +1 -0
- package/dist/render.js +3 -0
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js +13 -4
- package/dist/types.d.ts +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -11,24 +11,12 @@ Generates static TypeDoc pages in Markdown with frontmatter as part of the Docus
|
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
2. Install the plugin dependencies in the same location as the Docusaurus website directory.
|
|
14
|
+
> 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
15
|
|
|
18
16
|
```shell
|
|
19
|
-
cd docs-website
|
|
20
17
|
npm install typedoc typedoc-plugin-markdown docusaurus-plugin-typedoc --save-dev
|
|
21
18
|
```
|
|
22
19
|
|
|
23
|
-
```
|
|
24
|
-
├──docs-website (docusaurus location)
|
|
25
|
-
├── package.json
|
|
26
|
-
├──package.json
|
|
27
|
-
├──src (typescript source files)
|
|
28
|
-
├──tsconfig.json
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
|
|
32
20
|
## Usage
|
|
33
21
|
|
|
34
22
|
### Config
|
|
@@ -58,16 +46,21 @@ TypeDoc will be bootstraped with the Docusaurus `start` and `build` [cli command
|
|
|
58
46
|
"build": "docusaurus build",
|
|
59
47
|
```
|
|
60
48
|
|
|
61
|
-
Once built the docs will be available at `/docs/api` or equivalent out directory.
|
|
49
|
+
Once built the docs will be available at `/docs/api` (or equivalent out directory).
|
|
50
|
+
|
|
51
|
+
### Directory structure
|
|
62
52
|
|
|
63
53
|
```
|
|
64
|
-
|
|
65
|
-
├── build/ (static site dir)
|
|
66
|
-
├── docs/
|
|
67
|
-
│ ├── api/ (compiled typedoc markdown)
|
|
68
|
-
├── docusaurus.config.js
|
|
69
|
-
├── package.json
|
|
70
|
-
├── sidebars.js
|
|
54
|
+
├── docusauruss-website
|
|
55
|
+
├── build/ (static site dir)
|
|
56
|
+
├── docs/
|
|
57
|
+
│ ├── api/ (compiled typedoc markdown)
|
|
58
|
+
├── docusaurus.config.js
|
|
59
|
+
├── package.json
|
|
60
|
+
├── sidebars.js
|
|
61
|
+
├──package.json
|
|
62
|
+
├──src (typescript source files)
|
|
63
|
+
├──tsconfig.json
|
|
71
64
|
```
|
|
72
65
|
|
|
73
66
|
|
|
@@ -103,12 +96,12 @@ TypeDoc options can also be declared:
|
|
|
103
96
|
|
|
104
97
|
Options specific to the plugin should also be declared in the same object.
|
|
105
98
|
|
|
106
|
-
| Name | Default | Description
|
|
107
|
-
| :---------------------- | :------ |
|
|
108
|
-
| `out` | `"api"` | Output
|
|
109
|
-
| `sidebar.categoryLabel` | `API` | The sidebar parent category label.
|
|
110
|
-
| `sidebar.fullNames` | `false` | Display full names with module path.
|
|
111
|
-
| `sidebar.position` | `
|
|
99
|
+
| Name | Default | Description |
|
|
100
|
+
| :---------------------- | :------ | :------------------------------------------------------- |
|
|
101
|
+
| `out` | `"api"` | Output dir relative to docs dir (use `.` for no subdir). | |
|
|
102
|
+
| `sidebar.categoryLabel` | `API` | The sidebar parent category label. |
|
|
103
|
+
| `sidebar.fullNames` | `false` | Display full names with module path. |
|
|
104
|
+
| `sidebar.position` | `auto` | The position of the sidebar in the tree. |
|
|
112
105
|
|
|
113
106
|
### An example configuration
|
|
114
107
|
|
|
@@ -137,13 +130,16 @@ module.exports = {
|
|
|
137
130
|
};
|
|
138
131
|
```
|
|
139
132
|
|
|
140
|
-
## Sidebar and Navbar
|
|
141
133
|
|
|
142
|
-
|
|
134
|
+
## Recipes
|
|
135
|
+
|
|
136
|
+
### Sidebar and Navbar
|
|
137
|
+
|
|
138
|
+
#### Sidebar
|
|
143
139
|
|
|
144
140
|
`sidebars.js` can be configured in following ways:
|
|
145
141
|
|
|
146
|
-
1
|
|
142
|
+
1) Generate the entire sidebar from file structure of your docs folder (default behaviour):
|
|
147
143
|
|
|
148
144
|
```js
|
|
149
145
|
module.exports = {
|
|
@@ -156,9 +152,9 @@ module.exports = {
|
|
|
156
152
|
};
|
|
157
153
|
```
|
|
158
154
|
|
|
159
|
-
2
|
|
155
|
+
2) Alternatively, if you wish to manually control other parts of your sidebar you can use a slice for the TypeDoc sidebar.
|
|
160
156
|
|
|
161
|
-
>note: `sidebar.categoryLabel` and `sidebar.position` options are ignored with this implementation)
|
|
157
|
+
> note: `sidebar.categoryLabel` and `sidebar.position` options are ignored with this implementation)
|
|
162
158
|
|
|
163
159
|
```js
|
|
164
160
|
module.exports = {
|
|
@@ -176,7 +172,7 @@ module.exports = {
|
|
|
176
172
|
|
|
177
173
|
Please see https://docusaurus.io/docs/sidebar for sidebar documentation.
|
|
178
174
|
|
|
179
|
-
|
|
175
|
+
#### Navbar
|
|
180
176
|
|
|
181
177
|
A navbar item can be configured in `themeConfig` options in `docusaurus.config.js`:
|
|
182
178
|
|
|
@@ -197,7 +193,6 @@ A navbar item can be configured in `themeConfig` options in `docusaurus.config.j
|
|
|
197
193
|
|
|
198
194
|
Please see https://docusaurus.io/docs/api/themes/configuration#navbar-items for navbar documentation.
|
|
199
195
|
|
|
200
|
-
## Additional config
|
|
201
196
|
|
|
202
197
|
### Multi instance
|
|
203
198
|
|
package/dist/options.js
CHANGED
package/dist/render.js
CHANGED
package/dist/theme.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { SidebarOptions } from './types';
|
|
|
4
4
|
export declare class DocusaurusTheme extends MarkdownTheme {
|
|
5
5
|
sidebar: SidebarOptions;
|
|
6
6
|
readmeTitle: string;
|
|
7
|
+
indexSlug: string;
|
|
7
8
|
constructor(renderer: Renderer);
|
|
8
9
|
getRelativeUrl(url: string): string;
|
|
9
10
|
onPageEnd(page: PageEvent<DeclarationReflection>): void;
|
|
@@ -13,6 +14,7 @@ export declare class DocusaurusTheme extends MarkdownTheme {
|
|
|
13
14
|
getSidebarPosition(page: PageEvent<DeclarationReflection>): "0.5" | "0" | null;
|
|
14
15
|
getId(page: PageEvent): string;
|
|
15
16
|
getTitle(page: PageEvent): any;
|
|
17
|
+
getSlug(): string;
|
|
16
18
|
get mappings(): {
|
|
17
19
|
kind: ReflectionKind[];
|
|
18
20
|
isLeaf: boolean;
|
package/dist/theme.js
CHANGED
|
@@ -83,10 +83,7 @@ class DocusaurusTheme extends theme_1.MarkdownTheme {
|
|
|
83
83
|
title: pageTitle,
|
|
84
84
|
};
|
|
85
85
|
if (page.url === this.entryDocument) {
|
|
86
|
-
items = {
|
|
87
|
-
...items,
|
|
88
|
-
slug: `/${path.relative(process.cwd(), this.out).replace(/\\/g, '/')}/`,
|
|
89
|
-
};
|
|
86
|
+
items = { ...items, slug: this.getSlug() };
|
|
90
87
|
}
|
|
91
88
|
if (sidebarLabel && sidebarLabel !== pageTitle) {
|
|
92
89
|
items = { ...items, sidebar_label: sidebarLabel };
|
|
@@ -137,6 +134,15 @@ class DocusaurusTheme extends theme_1.MarkdownTheme {
|
|
|
137
134
|
}
|
|
138
135
|
return (0, front_matter_1.getPageTitle)(page);
|
|
139
136
|
}
|
|
137
|
+
getSlug() {
|
|
138
|
+
if (this.indexSlug) {
|
|
139
|
+
return this.indexSlug;
|
|
140
|
+
}
|
|
141
|
+
if (this.out === process.cwd()) {
|
|
142
|
+
return '/';
|
|
143
|
+
}
|
|
144
|
+
return `/${path.relative(process.cwd(), this.out).replace(/\\/g, '/')}/`;
|
|
145
|
+
}
|
|
140
146
|
get mappings() {
|
|
141
147
|
return super.mappings.map((mapping) => {
|
|
142
148
|
if (mapping.kind.includes(typedoc_1.ReflectionKind.Namespace)) {
|
|
@@ -158,6 +164,9 @@ __decorate([
|
|
|
158
164
|
__decorate([
|
|
159
165
|
(0, typedoc_1.BindOption)('readmeTitle')
|
|
160
166
|
], DocusaurusTheme.prototype, "readmeTitle", void 0);
|
|
167
|
+
__decorate([
|
|
168
|
+
(0, typedoc_1.BindOption)('indexSlug')
|
|
169
|
+
], DocusaurusTheme.prototype, "indexSlug", void 0);
|
|
161
170
|
exports.DocusaurusTheme = DocusaurusTheme;
|
|
162
171
|
const writeCategoryYaml = (categoryPath, label, position) => {
|
|
163
172
|
const yaml = [`label: "${label}"`];
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-plugin-typedoc",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.5",
|
|
4
4
|
"description": "A Docusaurus v2 plugin to build API documentation with TypeDoc.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"typescript",
|
|
43
43
|
"api"
|
|
44
44
|
],
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "eb289daac347deea984351f04ec7d5f82896d281"
|
|
46
46
|
}
|