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

Add @category tag #564

Closed
wbhob opened this issue Jul 21, 2017 · 9 comments
Closed

Add @category tag #564

wbhob opened this issue Jul 21, 2017 · 9 comments
Labels
enhancement Improved functionality

Comments

@wbhob
Copy link

wbhob commented Jul 21, 2017

Sometimes globally-scoped things can get pretty cluttered, so I was wondering if you all can add a @category tag to sort documented objects into groups.

@aciccarello aciccarello added the enhancement Improved functionality label Jul 21, 2017
@jonchardy
Copy link
Contributor

jonchardy commented Jul 24, 2017

I actually did this as part of our TypeDoc implementation. If you're curious, see jonchardy@c12381b. Alongside these changes, I updated our theme to sort our index page by category. There is some stuff specific to us like the weights for sorting, but you can change that up.

Excuse the organization, I usually push things to GitHub in batches.

The relevant changes are:
jonchardy@c12381b#diff-0d149f9b1469c3c2f367a941af1b0945
jonchardy@c12381b#diff-bd337a93cb6b55ec5c687ea8a327720e
jonchardy@c12381b#diff-739b66d6abaf9c587a31ae9909a64903
jonchardy@c12381b#diff-ebc8b0bc65bb184ea94b7734503a15f3
jonchardy@c12381b#diff-09c50b8d3de6159296d213ab8664a22a
jonchardy@c12381b#diff-431f5355945bc08849278b194d39a0df

@wbhob
Copy link
Author

wbhob commented Jul 24, 2017

Pr? @jonchardy

@jonchardy
Copy link
Contributor

Created PR #566. Feel free to take a look, discuss, and make any changes you feel will improve it.

emmanueltouzery added a commit to emmanueltouzery/prelude-ts that referenced this issue Oct 5, 2017
…ong/typedoc#564), and I don't want to use external modules, so I hack around it by telling to typedoc that I have external modules then doing string replace in its output (and then reverting the changes)
@aciccarello
Copy link
Collaborator

Closed by #566

@emmanueltouzery
Copy link

Regarding closing this bug: I didn't try the changes yet, but my understanding is that the PR which was pulled, according to its author "won't really do much without some accompanying changes to a theme". So I'm not sure this feature is really complete now. Is changing the theme documented?

@aciccarello
Copy link
Collaborator

@emmanueltouzery I think you are right. I'll reopen this. PRs are welcome to update the themes.

@aciccarello aciccarello reopened this Oct 13, 2017
@mootari
Copy link

mootari commented Jan 20, 2018

I would also love to see multiple @category tags handled. The current implementation only keeps the first tag value around. Example:

    /**
     * @category Foo
     * @category Bar
     */
  "tags": [
    {
      "tag": "category",
      "text": "Foo"
    },
    {
      "tag": "category",
      "text": "Bar\n"
    }
  ]

becomes:

  "categories": [
    {
      "title": "Foo",
      "children": [
        371
      ]
    }
  ]

@mootari
Copy link

mootari commented Jan 20, 2018

On a related note: I don't think it's a good idea to reformat the original category name. If need be this can be handled in the theme.

for (let i = 0; i < tags.length; i++) {
if (tags[i].tagName === 'category') {
let tag = tags[i].text;
return (tag.charAt(0).toUpperCase() + tag.slice(1).toLowerCase()).trim();
}
}

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Dec 30, 2019

I opened #1158 to track multiple categories, closing this as there is base functionality for categories already, and the themes have been updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improved functionality
Projects
None yet
Development

No branches or pull requests

6 participants