Skip to content

Commit 0b75e9f

Browse files
authored
Update reference doc generation (#5333)
* show functions table first * create toc only for entry points
1 parent 7818176 commit 0b75e9f

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

repo-scripts/api-documenter/src/documenters/MarkdownDocumenter.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,11 @@ export class MarkdownDocumenter {
918918
}
919919
}
920920

921+
if (functionsTable.rows.length > 0) {
922+
output.push(new DocHeading({ configuration, title: 'Functions' }));
923+
output.push(functionsTable);
924+
}
925+
921926
if (classesTable.rows.length > 0) {
922927
output.push(new DocHeading({ configuration, title: 'Classes' }));
923928
output.push(classesTable);
@@ -927,10 +932,6 @@ export class MarkdownDocumenter {
927932
output.push(new DocHeading({ configuration, title: 'Enumerations' }));
928933
output.push(enumerationsTable);
929934
}
930-
if (functionsTable.rows.length > 0) {
931-
output.push(new DocHeading({ configuration, title: 'Functions' }));
932-
output.push(functionsTable);
933-
}
934935

935936
if (interfacesTable.rows.length > 0) {
936937
output.push(new DocHeading({ configuration, title: 'Interfaces' }));

repo-scripts/api-documenter/src/toc.ts

+1-14
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ function generateTocRecursively(
7373
addFileNameSuffix: boolean,
7474
toc: ITocItem[]
7575
) {
76+
// generate toc item only for entry points
7677
if (apiItem.kind === ApiItemKind.EntryPoint) {
7778
// Entry point
7879
const entryPointName = (apiItem.canonicalReference
@@ -83,20 +84,6 @@ function generateTocRecursively(
8384
section: []
8485
};
8586

86-
for (const member of apiItem.members) {
87-
// only classes and interfaces have dedicated pages
88-
if (
89-
member.kind === ApiItemKind.Class ||
90-
member.kind === ApiItemKind.Interface
91-
) {
92-
const fileName = getFilenameForApiItem(member, addFileNameSuffix);
93-
entryPointToc.section!.push({
94-
title: member.displayName,
95-
path: `${g3Path}/${fileName}`
96-
});
97-
}
98-
}
99-
10087
toc.push(entryPointToc);
10188
} else {
10289
// travel the api tree to find the next entry point

0 commit comments

Comments
 (0)