in repo-scripts/api-documenter/src/documenters/MarkdownDocumenter.ts [368:500]
private _createClassTables(apiClass: ApiClass): DocNode[] {
const configuration = this._tsdocConfiguration;
const output: DocNode[] = [];
const eventsTable: DocTable = new DocTable({
configuration,
headerTitles: ['Property', 'Modifiers', 'Type', 'Description']
});
const constructorsTable: DocTable = new DocTable({
configuration,
headerTitles: ['Constructor', 'Modifiers', 'Description']
});
const propertiesTable: DocTable = new DocTable({
configuration,
headerTitles: ['Property', 'Modifiers', 'Type', 'Description']
});
const methodsTable: DocTable = new DocTable({
configuration,
headerTitles: ['Method', 'Modifiers', 'Description']
});
const constructorsDefinitions: DocNode[] = [];
const methodsDefinitions: DocNode[] = [];
const propertiesDefinitions: DocNode[] = [];
const eventsDefinitions: DocNode[] = [];
for (const apiMember of apiClass.members) {
switch (apiMember.kind) {
case ApiItemKind.Constructor: {
constructorsTable.addRow(
new DocTableRow({ configuration }, [
createTitleCell(
apiMember,
configuration,
this._addFileNameSuffix
),
createModifiersCell(apiMember, configuration),
createDescriptionCell(apiMember, configuration)
])
);
constructorsDefinitions.push(
...this._createCompleteOutputForApiItem(apiMember)
);
break;
}
case ApiItemKind.Method: {
methodsTable.addRow(
new DocTableRow({ configuration }, [
createTitleCell(
apiMember,
configuration,
this._addFileNameSuffix
),
createModifiersCell(apiMember, configuration),
createDescriptionCell(apiMember, configuration)
])
);
methodsDefinitions.push(
...this._createCompleteOutputForApiItem(apiMember)
);
break;
}
case ApiItemKind.Property: {
if ((apiMember as ApiPropertyItem).isEventProperty) {
eventsTable.addRow(
new DocTableRow({ configuration }, [
createTitleCell(
apiMember,
configuration,
this._addFileNameSuffix
),
createModifiersCell(apiMember, configuration),
this._createPropertyTypeCell(apiMember),
createDescriptionCell(apiMember, configuration)
])
);
eventsDefinitions.push(
...this._createCompleteOutputForApiItem(apiMember)
);
} else {
propertiesTable.addRow(
new DocTableRow({ configuration }, [
createTitleCell(
apiMember,
configuration,
this._addFileNameSuffix
),
createModifiersCell(apiMember, configuration),
this._createPropertyTypeCell(apiMember),
createDescriptionCell(apiMember, configuration)
])
);
propertiesDefinitions.push(
...this._createCompleteOutputForApiItem(apiMember)
);
}
break;
}
}
}
if (eventsTable.rows.length > 0) {
output.push(new DocHeading({ configuration, title: 'Events' }));
output.push(eventsTable);
}
if (constructorsTable.rows.length > 0) {
output.push(new DocHeading({ configuration, title: 'Constructors' }));
output.push(constructorsTable);
}
if (propertiesTable.rows.length > 0) {
output.push(new DocHeading({ configuration, title: 'Properties' }));
output.push(propertiesTable);
}
if (methodsTable.rows.length > 0) {
output.push(new DocHeading({ configuration, title: 'Methods' }));
output.push(methodsTable);
}
output.push(...eventsDefinitions);
output.push(...constructorsDefinitions);
output.push(...propertiesDefinitions);
output.push(...methodsDefinitions);
return output;
}