Skip to content

Update reference doc generation #5333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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