Files
AFFiNE/blocksuite/docs-site/typedoc-remove-inherited.mjs
2026-04-29 19:31:40 +08:00

35 lines
948 B
JavaScript

import { Converter } from 'typedoc';
export function load(app) {
app.converter.on(Converter.EVENT_RESOLVE_END, context => {
pruneInheritedReflections(context.project);
});
}
function pruneInheritedReflections(reflection) {
if (reflection.children) {
reflection.children = reflection.children.filter(
child => !child.inheritedFrom
);
reflection.children.forEach(pruneInheritedReflections);
}
if (reflection.groups) {
reflection.groups = reflection.groups
.map(group => ({
...group,
children: group.children.filter(child => !child.inheritedFrom),
}))
.filter(group => group.children.length > 0);
}
if (reflection.categories) {
reflection.categories = reflection.categories
.map(category => ({
...category,
children: category.children.filter(child => !child.inheritedFrom),
}))
.filter(category => category.children.length > 0);
}
}