Typedoc: To show "directory-based hierarchy" module indexes

Created on 13 Jan 2017  Â·  9Comments  Â·  Source: TypeStrong/typedoc

When I made class files:

(under scripts directory)
* _lib
  * common
    * Foo.ts (class Foo)
    * Bar.ts (class Bar)
* docparts
  * Head.ts (class Head)
  * Body.ts (class Body)
  * Foot.ts (class Foot)

typedoc shows module indexes as:

Body
Foo
Foot
Head

or

"_lib/common/Bar"
"_lib/common/Foo"
"docparts/Body"
"docparts/Foot"
"docparts/Head"

But I want to look them as:

  common
    Bar
    Foo
docparts
  Body
  Foot
  Head

In theory, the hierarchy must be decided by namespace(or package), but it seems that TS's "namespace" is not for. I'm grad if you all consider about this.
Thanks.

Most helpful comment

@aciccarello it isn't just the "files" mode - even when generating in "modules" mode it just prefixes the name of every single thing with the containing folder and presents it as a flat list. It seems like it would be trivial to simply create a hierarchy from the folder names (or at least have that as an option) since it is using them anyway to generate the names in the globals list.

For large projects I can't find any combination of options that doesn't just spit out a gigantic single top page with no hierarchical order of any kind. Its literally easier for me to read the documentation by browsing the source code because without the folders giving it some order, its just information overload.

All 9 comments

This is related to #68 and #242. I'd personally love to see the "files" module structure improved.

Oh, I've got what you and them said. It seems so difficult to have few meaning hierarchies in TS project…
Thanks for your reply.

@aciccarello it isn't just the "files" mode - even when generating in "modules" mode it just prefixes the name of every single thing with the containing folder and presents it as a flat list. It seems like it would be trivial to simply create a hierarchy from the folder names (or at least have that as an option) since it is using them anyway to generate the names in the globals list.

For large projects I can't find any combination of options that doesn't just spit out a gigantic single top page with no hierarchical order of any kind. Its literally easier for me to read the documentation by browsing the source code because without the folders giving it some order, its just information overload.

Just encountered the very same issue which I reported in #774. I'd appreciate if there was a way to categorize by folders in order to keep things both clean and prevent unexpected merges and overwrites.

+1

Any news on this?

As far as I know nobody's taken a theme and made it happen. It should be relatively easy to modify the default theme if you'd rather have this behavior.

__Good news for anyone looking for a solution!__

Someone at google did create a theme that provides a directory-based hierarchy for navigation!

The theme is called typedoc-neo-theme.

It provides a nice navigation structure - auto-generated and apparently also customizable.

If you're using npm, you can install it with npm install -D tyepdoc-neo-theme

Then you can update your tsdoc options to use it -- or specify the theme via a command line argument.

I'm specifying my typedoc options in tsconfig.json like this:

    "typedocOptions": {
        "inputFiles": [
            "./src"
        ],
        "theme": "node_modules/typedoc-neo-theme/bin/default",
        "mode": "modules",
        "out": "docs",
        "exclude": [
            "**/src/test/*",
            "**/*.test.ts",
            "**/__tests__/*",
            "**/__mocks__/*"
        ],
        "excludeNotExported": true
    },

@leilapearson
I suppose, that is the solution. I'll try it.
I close this issue now.

Thank you all.

Was this page helpful?
0 / 5 - 0 ratings