|
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 If I add a 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. So, is there an option to say "if no |
Replies: 1 comment 2 replies
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");
}
});
} |
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.