Skip to content

Commit b12258d

Browse files
committed
Add navigationLeaves option
Resolves #2382
1 parent 2cabd22 commit b12258d

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
### Features
44

5+
- Added `navigationLeaves` option to remove branches from the navigation tree, #2382.
56
- Improved support for multi-word searches, #2400.
67

78
### Bug Fixes

src/lib/output/themes/default/DefaultTheme.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ export class DefaultTheme extends Theme {
246246
// eslint-disable-next-line @typescript-eslint/no-this-alias
247247
const theme = this;
248248
const opts = this.application.options.getValue("navigation");
249+
const leaves = this.application.options.getValue("navigationLeaves");
249250

250251
if (opts.fullTree) {
251252
this.application.logger.warn(
@@ -288,6 +289,10 @@ export class DefaultTheme extends Theme {
288289
return parent.children.map(toNavigation);
289290
}
290291

292+
if (leaves.includes(parent.getFullName())) {
293+
return;
294+
}
295+
291296
if (!parent.kindOf(ReflectionKind.SomeModule | ReflectionKind.Project)) {
292297
return;
293298
}

src/lib/utils/options/declaration.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ export interface TypeDocOptionMap {
139139
titleLink: string;
140140
navigationLinks: ManuallyValidatedOption<Record<string, string>>;
141141
sidebarLinks: ManuallyValidatedOption<Record<string, string>>;
142+
navigationLeaves: string[];
142143
navigation: {
143144
includeCategories: boolean;
144145
includeGroups: boolean;

src/lib/utils/options/sources/typedoc.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,11 @@ export function addTypeDocOptions(options: Pick<Options, "addDeclaration">) {
447447
}
448448
},
449449
});
450-
450+
options.addDeclaration({
451+
name: "navigationLeaves",
452+
help: "Branches of the navigation tree which should not be expanded.",
453+
type: ParameterType.Array,
454+
});
451455
options.addDeclaration({
452456
name: "navigation",
453457
help: "Determines how the navigation sidebar is organized.",

0 commit comments

Comments
 (0)