chore: add command to generate reference docs (#6506)

* chore: add command to generate reference docs

* chore: format

* chore: add comments and fix names

* chore: format

* chore:update patch for latest api documenter version

* chore: fix package-lock
This commit is contained in:
Maribeth Bottorff
2022-11-09 10:55:49 -08:00
committed by GitHub
parent 024e9c5cc6
commit 010a56bfad
5 changed files with 891 additions and 5 deletions

View File

@@ -0,0 +1,87 @@
diff --git a/node_modules/@microsoft/api-documenter/lib/documenters/MarkdownDocumenter.js b/node_modules/@microsoft/api-documenter/lib/documenters/MarkdownDocumenter.js
index 421f89f..b9d329b 100644
--- a/node_modules/@microsoft/api-documenter/lib/documenters/MarkdownDocumenter.js
+++ b/node_modules/@microsoft/api-documenter/lib/documenters/MarkdownDocumenter.js
@@ -856,12 +856,15 @@ class MarkdownDocumenter {
}
_writeBreadcrumb(output, apiItem) {
const configuration = this._tsdocConfiguration;
- output.appendNodeInParagraph(new tsdoc_1.DocLinkTag({
- configuration,
- tagName: '@link',
- linkText: 'Home',
- urlDestination: this._getLinkFilenameForApiItem(this._apiModel)
- }));
+ // Don't print the first breadcrumb, because there's only one package, so we don't need the Home link.
+ // output.appendNodeInParagraph(new tsdoc_1.DocLinkTag({
+ // configuration,
+ // tagName: '@link',
+ // linkText: 'Home',
+ // urlDestination: this._getLinkFilenameForApiItem(this._apiModel)
+ // }));
+
+ let first = true;
for (const hierarchyItem of apiItem.getHierarchy()) {
switch (hierarchyItem.kind) {
case api_extractor_model_1.ApiItemKind.Model:
@@ -871,18 +874,24 @@ class MarkdownDocumenter {
// this may change in the future.
break;
default:
- output.appendNodesInParagraph([
- new tsdoc_1.DocPlainText({
- configuration,
- text: ' > '
- }),
+ // Only print the breadcrumb separator if it's not the first item we're printing.
+ if (!first) {
+ output.appendNodeInParagraph(
+ new tsdoc_1.DocPlainText({
+ configuration,
+ text: ' > '
+ })
+ );
+ }
+ first = false;
+ output.appendNodeInParagraph(
new tsdoc_1.DocLinkTag({
configuration,
tagName: '@link',
linkText: hierarchyItem.displayName,
urlDestination: this._getLinkFilenameForApiItem(hierarchyItem)
})
- ]);
+ );
}
}
}
@@ -947,11 +956,13 @@ class MarkdownDocumenter {
// For overloaded methods, add a suffix such as "MyClass.myMethod_2".
let qualifiedName = Utilities_1.Utilities.getSafeFilenameForName(hierarchyItem.displayName);
if (api_extractor_model_1.ApiParameterListMixin.isBaseClassOf(hierarchyItem)) {
- if (hierarchyItem.overloadIndex > 1) {
- // Subtract one for compatibility with earlier releases of API Documenter.
- // (This will get revamped when we fix GitHub issue #1308)
- qualifiedName += `_${hierarchyItem.overloadIndex - 1}`;
- }
+ // https://github.com/microsoft/rushstack/issues/1921
+ // if (hierarchyItem.overloadIndex > 1) {
+ // // Subtract one for compatibility with earlier releases of API Documenter.
+ // // (This will get revamped when we fix GitHub issue #1308)
+ // qualifiedName += `_${hierarchyItem.overloadIndex - 1}`;
+ // }
+ qualifiedName += `_${hierarchyItem.overloadIndex}`;
}
switch (hierarchyItem.kind) {
case api_extractor_model_1.ApiItemKind.Model:
@@ -962,7 +973,9 @@ class MarkdownDocumenter {
baseName = Utilities_1.Utilities.getSafeFilenameForName(node_core_library_1.PackageName.getUnscopedName(hierarchyItem.displayName));
break;
default:
- baseName += '.' + qualifiedName;
+ // https://github.com/microsoft/rushstack/issues/1921
+ // baseName += '.' + qualifiedName;
+ baseName += '.' + qualifiedName + '_' + hierarchyItem.kind.toLowerCase();
}
}
return baseName + '.md';