Replies: 1 comment
-
You want the groupOrder option, the kindSortOrder option defines the ordering of reflections within a group or category.
There is not, that's a very specific configuration... However, it is not hard to write a custom plugin which does this and can even be inlined in your configuration file. // CC0
import * as td from "typedoc";
/** @param {td.Application} app */
export function load(app) {
app.converter.on(td.Converter.EVENT_RESOLVE, (_context, refl) => {
if (!refl.isDeclaration()) return;
// It probably only really makes sense to do this to modules, enumerations
// look rather weird when all their members are under "Other"
if (!refl.kindOf(td.ReflectionKind.ExportContainer)) return;
const children = refl.childrenIncludingDocuments || [];
if (!children.some(child => child.comment?.getTag("@group") || child.comment?.getTag("@category"))) {
// The category plugin won't re-do work if reflections have already been categorized, so we can
// just specify the categories here directly. You could also use groups here instead of categories.
refl.categories = [
new td.ReflectionCategory(app.options.getValue("defaultCategory")),
];
refl.categories[0].children = [...children];
// You might want to consider instead disabling grouping for this reflection,
// categories will also do nothing since there are no @category comments.
// refl.comment ||= new td.Comment();
// refl.comment.modifierTags.add("@disableGroups");
}
});
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
So, trying to convert a large codebase to Typedoc… 🎉
With default setup, the pages are organised by kinds: "Namespaces, Classes, …" (and seem to not respect
kindSortOrder🤔). This is not how I prefer to display them (for reasons, I can elaborate if needed).If I add a
@category Footag to some entries, then the page gets organised as "Foo, Other" categories (andkindSortOrderis respected within each category); if I add a@group Footag instead, then it gets organised as "Foo, Namespace, Classes, …" groups and kinds.Now, the thing is that I prefer the way things are shown in the "category" case, even for the content of the "Other" default category, I think it makes more sense (for this codebase) to present stuff that way than separated by kind.
But it is not very realistic to add a category to all entries, or even to sufficiently many to trigger that mode on every page (given the size of my codebase… this may happen organically as time goes, but definitely not during initial setup).
So, is there an option to say "if no
@groupnor@categorytags are present, treat that as 'everything is in the Other category' rather than defaulting to grouping by kinds"?Beta Was this translation helpful? Give feedback.
All reactions