Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to disable compact navigation structure when a category contains only one reflection #2667

Closed
NkemdiAnyiam opened this issue Aug 14, 2024 · 4 comments
Labels
enhancement Improved functionality good first issue Easier issue for first time contributors help wanted Contributions are especially encouraged
Milestone

Comments

@NkemdiAnyiam
Copy link

NkemdiAnyiam commented Aug 14, 2024

Search Terms

compact, navigation, single reflection

Problem

Given: The typedoc.json navigation.includeCategories option is set to true.

When there is only one reflection with a given @category tag, the rendered docs will not render the category as a dropdown. Instead, it will be displayed in a compact form, i.e., "(category name)/(reflection name)". This can be visually confusing (and aesthetically unpleasing), especially when there are other categories that are not compacted.

For example, suppose I have a module named colors.ts which has 7 interfaces named Red, Orange, Yellow, Green, Blue, Purple, and Gray and 1 class named Color. And suppose I separated the interfaces into 3 categories: "Warm", "Cool", and "Neutral". The rendered navigation for the colors module would look like the following:
image
I would like to be able to render it as a dropdown like the following despite Gray being the only reflection categorized under "Neutral":
image

Suggested Solution

Add an additional boolean configuration option like navigation.compactOrganization or navigation.compactStructure (I'm not sure of the best name). It can default to true (in which case, nothing changes), but if set to false, categories (and groups) containing only a single reflection will still render a dropdown.

@NkemdiAnyiam NkemdiAnyiam added the enhancement Improved functionality label Aug 14, 2024
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Aug 14, 2024

With #2656 I believe this is unnecessary

@NkemdiAnyiam
Copy link
Author

NkemdiAnyiam commented Aug 14, 2024

#2656 was for a way to prevent reflections from being placed into an "Other" dropdown. This new issue is for a way to prevent dropdowns from being compacted into a categoryName/singleReflection form. The way it is now, if Gray is the only thing with "@category Neutral", the navigation UI will look like this:

  • T Neutral/Gray

But I want the option to tell it to just go ahead and treat it as if there were multiple reflections with "@category Neutral" so that it renders as a normal dropdown like this:

  • Neutral (down carrot)
    • T Gray

@NkemdiAnyiam
Copy link
Author

NkemdiAnyiam commented Aug 14, 2024

I think what I'm trying to describe is a little confusing, but I think showing an example of what VSCode does should clarify what I'm asking for. In VSCode, if a folder A contains only one single folder B, the explorer just renders it as A/B, like this:
image

But in the settings.json, if explorer.compactFolders is set to false, it renders A as a normal dropdown with B as a child (which is what I prefer) like this:.
image

I would like a similar setting for typedoc.json (something like navigation.compactOrganization, navigation.compactStructure, navigation.compactFolders—whatever name fits the best). This way, categories or groups that only have a single reflection are still rendered as dropdowns instead of being compacted (as demonstrated by the screenshots of the example docs in my original post). The setting would look something like this:
image

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Aug 15, 2024

Gotcha, that makes sense!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improved functionality good first issue Easier issue for first time contributors help wanted Contributions are especially encouraged
Projects
None yet
Development

No branches or pull requests

2 participants