Skip to content

Commit

Permalink
Update reference doc generation (#5333)
Browse files Browse the repository at this point in the history
* show functions table first

* create toc only for entry points
  • Loading branch information
Feiyang1 authored Aug 24, 2021
1 parent 7818176 commit 0b75e9f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,11 @@ export class MarkdownDocumenter {
}
}

if (functionsTable.rows.length > 0) {
output.push(new DocHeading({ configuration, title: 'Functions' }));
output.push(functionsTable);
}

if (classesTable.rows.length > 0) {
output.push(new DocHeading({ configuration, title: 'Classes' }));
output.push(classesTable);
Expand All @@ -927,10 +932,6 @@ export class MarkdownDocumenter {
output.push(new DocHeading({ configuration, title: 'Enumerations' }));
output.push(enumerationsTable);
}
if (functionsTable.rows.length > 0) {
output.push(new DocHeading({ configuration, title: 'Functions' }));
output.push(functionsTable);
}

if (interfacesTable.rows.length > 0) {
output.push(new DocHeading({ configuration, title: 'Interfaces' }));
Expand Down
15 changes: 1 addition & 14 deletions repo-scripts/api-documenter/src/toc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ function generateTocRecursively(
addFileNameSuffix: boolean,
toc: ITocItem[]
) {
// generate toc item only for entry points
if (apiItem.kind === ApiItemKind.EntryPoint) {
// Entry point
const entryPointName = (apiItem.canonicalReference
Expand All @@ -83,20 +84,6 @@ function generateTocRecursively(
section: []
};

for (const member of apiItem.members) {
// only classes and interfaces have dedicated pages
if (
member.kind === ApiItemKind.Class ||
member.kind === ApiItemKind.Interface
) {
const fileName = getFilenameForApiItem(member, addFileNameSuffix);
entryPointToc.section!.push({
title: member.displayName,
path: `${g3Path}/${fileName}`
});
}
}

toc.push(entryPointToc);
} else {
// travel the api tree to find the next entry point
Expand Down

0 comments on commit 0b75e9f

Please sign in to comment.