diff --git a/.config/typedoc.json b/.config/typedoc.json index 2705b525f..441428ece 100644 --- a/.config/typedoc.json +++ b/.config/typedoc.json @@ -37,6 +37,9 @@ "Enumerations": 2.0, "Type Aliases": 2.0 }, + "navigation": { + "fullTree": true + }, "includeVersion": true, "logLevel": "Verbose" } diff --git a/CHANGELOG.md b/CHANGELOG.md index b13dc9246..e84263c2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ### Features - Added support for TypeScript 5.1, #2296. +- Added `navigation.fullTree` to control rendering the full navigation tree on each page, #2287. + This option will likely be replaced in 0.25 with dynamic loading of the full tree. - TypeDoc's `--pretty` option now also controls whether generated HTML contains line breaks, #2287. - Optimized icon caching to reduce file size in generated HTML documentation, #2287. - Render property description of "roughly top level" object types, #2276. diff --git a/src/lib/output/themes/default/partials/navigation.tsx b/src/lib/output/themes/default/partials/navigation.tsx index 98d98d0e2..f69c1b372 100644 --- a/src/lib/output/themes/default/partials/navigation.tsx +++ b/src/lib/output/themes/default/partials/navigation.tsx @@ -156,12 +156,12 @@ export function navigation(context: DefaultThemeRenderContext, props: PageEvent< function links(mod: NavigationElement, parents: string[]) { const nameClasses = classNames( { deprecated: mod instanceof Reflection && mod.isDeprecated() }, - !(mod instanceof Reflection) || mod.isProject() ? void 0 : context.getReflectionClasses(mod) + mod instanceof DeclarationReflection ? context.getReflectionClasses(mod) : void 0 ); const children = getNavigationElements(mod, opts); - if (!children.length) { + if (!children.length || (!opts.fullTree && mod instanceof Reflection && !inPath(mod))) { return createNavElement(mod, nameClasses); } diff --git a/src/lib/utils/options/declaration.ts b/src/lib/utils/options/declaration.ts index 327088c9a..05232d3f8 100644 --- a/src/lib/utils/options/declaration.ts +++ b/src/lib/utils/options/declaration.ts @@ -139,6 +139,7 @@ export interface TypeDocOptionMap { navigation: { includeCategories: boolean; includeGroups: boolean; + fullTree: boolean; }; visibilityFilters: ManuallyValidatedOption<{ protected?: boolean; diff --git a/src/lib/utils/options/sources/typedoc.ts b/src/lib/utils/options/sources/typedoc.ts index bc1e48fc9..e4cac99f1 100644 --- a/src/lib/utils/options/sources/typedoc.ts +++ b/src/lib/utils/options/sources/typedoc.ts @@ -440,6 +440,7 @@ export function addTypeDocOptions(options: Pick) { defaults: { includeCategories: false, includeGroups: false, + fullTree: false, }, });