docusaurus-plugin-typedoc 1.0.0-next.20 → 1.0.0-next.22
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/plugin.js +4 -2
- package/dist/sidebar.d.ts +1 -1
- package/dist/sidebar.js +10 -7
- package/package.json +2 -2
package/dist/plugin.js
CHANGED
|
@@ -61,7 +61,7 @@ exports.default = pluginDocusaurus;
|
|
|
61
61
|
* Initiates a new typedoc Application bootstraped with plugin options
|
|
62
62
|
*/
|
|
63
63
|
async function generateTypedoc(context, opts) {
|
|
64
|
-
var _a, _b;
|
|
64
|
+
var _a, _b, _c;
|
|
65
65
|
const { siteDir } = context;
|
|
66
66
|
const options = (0, options_1.getPluginOptions)(opts);
|
|
67
67
|
const { id, sidebar, ...optionsPassedToTypeDoc } = options;
|
|
@@ -77,14 +77,16 @@ async function generateTypedoc(context, opts) {
|
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
if (sidebar === null || sidebar === void 0 ? void 0 : sidebar.autoConfiguration) {
|
|
80
|
+
const docsPreset = (_c = context.siteConfig) === null || _c === void 0 ? void 0 : _c.presets.find((preset) => { var _a; return Boolean((_a = preset[1]) === null || _a === void 0 ? void 0 : _a.docs); });
|
|
80
81
|
app.renderer.postRenderAsyncJobs.push(async (output) => {
|
|
82
|
+
var _a, _b;
|
|
81
83
|
const sidebarPath = path.resolve(outputDir, 'typedoc-sidebar.cjs');
|
|
82
84
|
const baseDir = path
|
|
83
85
|
.relative(siteDir, outputDir)
|
|
84
86
|
.split(path.sep)
|
|
85
87
|
.slice(1)
|
|
86
88
|
.join(path.sep);
|
|
87
|
-
const sidebarJson = (0, sidebar_1.getSidebar)(output.navigation, baseDir, sidebar.filteredIds);
|
|
89
|
+
const sidebarJson = (0, sidebar_1.getSidebar)(output.navigation, baseDir, sidebar.filteredIds, (_b = (_a = docsPreset[1]) === null || _a === void 0 ? void 0 : _a.docs) === null || _b === void 0 ? void 0 : _b.numberPrefixParser);
|
|
88
90
|
fs.writeFileSync(sidebarPath, `// @ts-check
|
|
89
91
|
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
|
90
92
|
const typedocSidebar = { items: ${JSON.stringify(sidebarJson, null, sidebar.pretty ? 2 : 0)}};
|
package/dist/sidebar.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { NavigationItem } from 'typedoc-plugin-markdown';
|
|
2
|
-
export declare function getSidebar(navigation: NavigationItem[], basePath: string, filteredIds?: string[]): any;
|
|
2
|
+
export declare function getSidebar(navigation: NavigationItem[], basePath: string, filteredIds?: string[], numberPrefixParser?: any): any;
|
package/dist/sidebar.js
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSidebar = void 0;
|
|
4
|
-
function getSidebar(navigation, basePath, filteredIds = []) {
|
|
4
|
+
function getSidebar(navigation, basePath, filteredIds = [], numberPrefixParser) {
|
|
5
5
|
return navigation
|
|
6
|
-
.map((navigationItem) => getNavigationItem(navigationItem, basePath, filteredIds))
|
|
6
|
+
.map((navigationItem) => getNavigationItem(navigationItem, basePath, filteredIds, numberPrefixParser))
|
|
7
7
|
.filter((navItem) => Boolean(navItem));
|
|
8
8
|
}
|
|
9
9
|
exports.getSidebar = getSidebar;
|
|
10
|
-
function getNavigationItem(navigationItem, basePath, filteredIds) {
|
|
11
|
-
var _a;
|
|
10
|
+
function getNavigationItem(navigationItem, basePath, filteredIds, numberPrefixParser) {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
const parsedUrl = numberPrefixParser === false
|
|
13
|
+
? navigationItem.url
|
|
14
|
+
: (_a = navigationItem.url) === null || _a === void 0 ? void 0 : _a.replace(/\d+\-/g, '');
|
|
12
15
|
const id = navigationItem.url
|
|
13
|
-
? `${basePath}/${
|
|
16
|
+
? `${basePath}/${parsedUrl}`.replace(/(.*).md/, '$1')
|
|
14
17
|
: null;
|
|
15
|
-
if ((
|
|
18
|
+
if ((_b = navigationItem.children) === null || _b === void 0 ? void 0 : _b.length) {
|
|
16
19
|
return {
|
|
17
20
|
type: 'category',
|
|
18
21
|
label: navigationItem.title,
|
|
19
|
-
items: getSidebar(navigationItem.children, basePath, filteredIds),
|
|
22
|
+
items: getSidebar(navigationItem.children, basePath, filteredIds, numberPrefixParser),
|
|
20
23
|
...(id && { link: { type: 'doc', id } }),
|
|
21
24
|
};
|
|
22
25
|
}
|
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.22",
|
|
4
4
|
"description": "A Docusaurus 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.28"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"lint": "eslint ./src --ext .ts",
|