docusaurus-plugin-typedoc 0.17.4 → 0.17.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/options.js CHANGED
@@ -12,6 +12,7 @@ const DEFAULT_PLUGIN_OPTIONS = {
12
12
  indexLabel: undefined,
13
13
  readmeLabel: 'Readme',
14
14
  position: null,
15
+ autoConfiguration: true,
15
16
  },
16
17
  hideInPageTOC: true,
17
18
  hideBreadcrumbs: true,
package/dist/theme.d.ts CHANGED
@@ -16,7 +16,6 @@ export declare class DocusaurusTheme extends MarkdownTheme {
16
16
  getSidebarPosition(page: PageEvent<DeclarationReflection>): "0.5" | "0" | null;
17
17
  getId(page: PageEvent): string;
18
18
  getTitle(page: PageEvent): any;
19
- getSlug(): string;
20
19
  get mappings(): {
21
20
  kind: ReflectionKind[];
22
21
  isLeaf: boolean;
package/dist/theme.js CHANGED
@@ -30,11 +30,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
30
30
  };
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
32
  exports.DocusaurusTheme = void 0;
33
- const typedoc_1 = require("typedoc");
34
33
  const fs = __importStar(require("fs"));
35
- const theme_1 = require("typedoc-plugin-markdown/dist/theme");
36
- const groups_1 = require("typedoc-plugin-markdown/dist/groups");
37
34
  const path = __importStar(require("path"));
35
+ const typedoc_1 = require("typedoc");
36
+ const groups_1 = require("typedoc-plugin-markdown/dist/groups");
37
+ const theme_1 = require("typedoc-plugin-markdown/dist/theme");
38
38
  const front_matter_1 = require("typedoc-plugin-markdown/dist/utils/front-matter");
39
39
  const CATEGORY_POSITION = {
40
40
  [typedoc_1.ReflectionKind.Module]: 1,
@@ -69,14 +69,16 @@ class DocusaurusTheme extends theme_1.MarkdownTheme {
69
69
  }
70
70
  }
71
71
  onRendererEnd(renderer) {
72
- writeCategoryYaml(renderer.outputDirectory, this.sidebar.categoryLabel, this.sidebar.position);
73
- Object.keys(groupUrlsByKind(this.getUrls(renderer.project))).forEach((group) => {
74
- const kind = parseInt(group);
75
- const mapping = this.mappings.find((mapping) => mapping.kind.includes(kind));
76
- if (mapping) {
77
- writeCategoryYaml(renderer.outputDirectory + '/' + mapping.directory, (0, groups_1.getKindPlural)(kind), CATEGORY_POSITION[kind]);
78
- }
79
- });
72
+ if (this.sidebar.autoConfiguration) {
73
+ writeCategoryYaml(renderer.outputDirectory, this.sidebar.categoryLabel, this.sidebar.position);
74
+ Object.keys(groupUrlsByKind(this.getUrls(renderer.project))).forEach((group) => {
75
+ const kind = parseInt(group);
76
+ const mapping = this.mappings.find((mapping) => mapping.kind.includes(kind));
77
+ if (mapping) {
78
+ writeCategoryYaml(renderer.outputDirectory + '/' + mapping.directory, (0, groups_1.getKindPlural)(kind), CATEGORY_POSITION[kind]);
79
+ }
80
+ });
81
+ }
80
82
  }
81
83
  getYamlItems(page) {
82
84
  const pageId = this.getId(page);
@@ -87,14 +89,16 @@ class DocusaurusTheme extends theme_1.MarkdownTheme {
87
89
  id: pageId,
88
90
  title: pageTitle,
89
91
  };
90
- if (page.url === this.entryDocument) {
91
- items = { ...items, slug: this.getSlug() };
92
+ if (page.url === this.entryDocument && this.indexSlug) {
93
+ items = { ...items, slug: this.indexSlug };
92
94
  }
93
- if (sidebarLabel && sidebarLabel !== pageTitle) {
94
- items = { ...items, sidebar_label: sidebarLabel };
95
- }
96
- if (sidebarPosition) {
97
- items = { ...items, sidebar_position: parseFloat(sidebarPosition) };
95
+ if (this.sidebar.autoConfiguration) {
96
+ if (sidebarLabel && sidebarLabel !== pageTitle) {
97
+ items = { ...items, sidebar_label: sidebarLabel };
98
+ }
99
+ if (sidebarPosition) {
100
+ items = { ...items, sidebar_position: parseFloat(sidebarPosition) };
101
+ }
98
102
  }
99
103
  if (page.url === page.project.url && this.entryPoints.length > 1) {
100
104
  items = { ...items, hide_table_of_contents: true };
@@ -142,15 +146,6 @@ class DocusaurusTheme extends theme_1.MarkdownTheme {
142
146
  }
143
147
  return (0, front_matter_1.getPageTitle)(page);
144
148
  }
145
- getSlug() {
146
- if (this.indexSlug) {
147
- return this.indexSlug;
148
- }
149
- if (this.out === process.cwd()) {
150
- return '/';
151
- }
152
- return `/${path.relative(process.cwd(), this.out).replace(/\\/g, '/')}/`;
153
- }
154
149
  get mappings() {
155
150
  return super.mappings.map((mapping) => {
156
151
  if (mapping.kind.includes(typedoc_1.ReflectionKind.Namespace)) {
package/dist/types.d.ts CHANGED
@@ -28,6 +28,7 @@ export interface SidebarOptions {
28
28
  indexLabel?: string;
29
29
  readmeLabel?: string;
30
30
  position: number | null;
31
+ autoConfiguration: boolean;
31
32
  }
32
33
  export interface SidebarCategory {
33
34
  type: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docusaurus-plugin-typedoc",
3
- "version": "0.17.4",
3
+ "version": "0.17.5",
4
4
  "description": "A Docusaurus v2 plugin to build API documentation with TypeDoc.",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -39,5 +39,5 @@
39
39
  "typescript",
40
40
  "api"
41
41
  ],
42
- "gitHead": "57c7498a9c3d2a82e803ed98f905258b25f4f4eb"
42
+ "gitHead": "e4e2f96384fdc3d93b172c4ce64df56ba66f1528"
43
43
  }