typedoc icon indicating copy to clipboard operation
typedoc copied to clipboard

Allow categorizing exported types in the sidebar

Open thislooksfun opened this issue 4 years ago • 6 comments

Search Terms

sidebar, category, exports, class, interface

Problem

When exporting a large project the sidebar quickly gets overloaded with semi-internal types that 99% of users won't use, thus burying the types that are actually relevant.

Suggested Solution

It would be great if adding @category foo-bar to an exported type would split the sidebar into groups. This would then allow for use cases such as:

  • having a single main export (function/class/etc) that is prominently separated from all the helper types
  • logically grouping like types that have disparate names
  • segregating away all the types that are only exposed for the <1% of people who might need them

thislooksfun avatar Mar 11 '21 23:03 thislooksfun

Dupe of #1332, which I could have sworn I replied to with the issues I ran into the last time I tried this... but apparently not

Essentially what stopped this then was that the sidebar then no longer matched the page order... but I just ran another test, and apparently this would correct this problem, not cause it!

It wouldn't fix the "functions with multiple categories get rendered twice" issue, but that's fine. I don't have a good solution for this yet. image

Gerrit0 avatar Mar 12 '21 22:03 Gerrit0

Yeah I thought it might be a dupe of that, but it was so terse I couldn't fully tell.

I know it's only semi-related, but I would consider the double-declaration a feature, not a bug. If it's in multiple categories I would honestly expect it to do that.

thislooksfun avatar Mar 12 '21 22:03 thislooksfun

That's... a really good point. Okay, yeah, I'd be fine treating that as a feature. Just need to fix the duplicate id in the page for links in 0.21 then.

Gerrit0 avatar Mar 12 '21 23:03 Gerrit0

It would be cool if this could cover instance members for interfaces and classes as well as exported members of modules.

nex3 avatar Oct 08 '21 23:10 nex3

Any news regarding this feature @Gerrit0? thanks for the tool btw it's awesome

tmigone avatar Jan 20 '22 14:01 tmigone

Nope, I don't think this was something that was done in #1794, shouldn't be too difficult to do though.

Gerrit0 avatar Jan 23 '22 01:01 Gerrit0

is this feature available now ? Don't see any news regarding this feature

minologyVN avatar Feb 23 '23 04:02 minologyVN

Now that it's implemented, it took me some time to figure out how to actually use the feature, and in the end it was as simple as adding the following to my typedoc.json (you can change the category names of course):

{
    "navigation": {
        "includeCategories": true
    },
    "defaultCategory": "Utility",
    "categoryOrder": [
        "Core",
        "Utility",
        "Advanced",
        "Internal"
    ]
}

Then you can tag types/functions/etc with @category <name> and they will be displayed under this section in the sidebar.

Btw a thousand times thank you for this great tool! It's simple to use and the generated documentation is really good looking and easy to navigate.

symil avatar Jan 09 '24 17:01 symil