typedoc-plugin-markdown
Version:
A plugin for TypeDoc that enables TypeScript API documentation to be generated in Markdown.
25 lines (24 loc) • 792 B
JavaScript
import { ReflectionKind } from 'typedoc';
export function typeDeclaration(model, options) {
const md = [];
const shouldDisplayTable = () => {
if (model.parent?.kind === ReflectionKind.Property &&
this.helpers.useTableFormat('propertyMembers')) {
return true;
}
if (model.parent?.kind !== ReflectionKind.Property &&
this.helpers.useTableFormat('typeDeclarations')) {
return true;
}
return false;
};
if (shouldDisplayTable()) {
md.push(this.partials.typeDeclarationTable(model.children || [], {
kind: model.parent?.kind,
}));
}
else {
md.push(this.partials.typeDeclarationList(model.children || [], options));
}
return md.join('\n\n');
}