Files
blockly/patches/@microsoft+api-documenter+7.22.4.patch
Maribeth Moffatt f37e7fede2 chore: fix docs generation script (#9251)
* chore: pin api-documenter to a version that uses markdown tables

* chore: fix docs generation errors

* chore: update patch for api-documenter
2025-07-24 09:28:18 -07:00

77 lines
3.8 KiB
Diff

diff --git a/node_modules/@microsoft/api-documenter/lib/documenters/MarkdownDocumenter.js b/node_modules/@microsoft/api-documenter/lib/documenters/MarkdownDocumenter.js
index 5284d10..4f8b439 100644
--- a/node_modules/@microsoft/api-documenter/lib/documenters/MarkdownDocumenter.js
+++ b/node_modules/@microsoft/api-documenter/lib/documenters/MarkdownDocumenter.js
@@ -877,12 +877,14 @@ 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:
@@ -892,18 +894,23 @@ class MarkdownDocumenter {
// this may change in the future.
break;
default:
- output.appendNodesInParagraph([
+ if (!first) {
+ // Only print the breadcrumb separator if it's not the first item we're printing.
+ 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)
})
- ]);
+ );
}
}
}
@@ -968,11 +975,8 @@ 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
+ qualifiedName += `_${hierarchyItem.overloadIndex}`;
}
switch (hierarchyItem.kind) {
case api_extractor_model_1.ApiItemKind.Model:
@@ -983,7 +987,8 @@ 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 + '_' + hierarchyItem.kind.toLowerCase();
}
}
return baseName + '.md';