summaryrefslogtreecommitdiffstats
path: root/remote/test/puppeteer/tools/docgen
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--remote/test/puppeteer/tools/docgen/package.json8
-rw-r--r--remote/test/puppeteer/tools/docgen/src/custom_markdown_documenter.ts306
2 files changed, 172 insertions, 142 deletions
diff --git a/remote/test/puppeteer/tools/docgen/package.json b/remote/test/puppeteer/tools/docgen/package.json
index 82f6d4d6c4..a89323e31b 100644
--- a/remote/test/puppeteer/tools/docgen/package.json
+++ b/remote/test/puppeteer/tools/docgen/package.json
@@ -24,10 +24,10 @@
}
},
"devDependencies": {
- "@microsoft/api-extractor": "7.42.2",
- "@microsoft/api-documenter": "7.23.35",
- "@microsoft/api-extractor-model": "7.28.13",
+ "@microsoft/api-extractor": "7.43.1",
+ "@microsoft/api-documenter": "7.24.2",
+ "@microsoft/api-extractor-model": "7.28.14",
"@microsoft/tsdoc": "0.14.2",
- "@rushstack/node-core-library": "4.0.2"
+ "@rushstack/node-core-library": "4.1.0"
}
}
diff --git a/remote/test/puppeteer/tools/docgen/src/custom_markdown_documenter.ts b/remote/test/puppeteer/tools/docgen/src/custom_markdown_documenter.ts
index d63a8b96ef..abf48e200c 100644
--- a/remote/test/puppeteer/tools/docgen/src/custom_markdown_documenter.ts
+++ b/remote/test/puppeteer/tools/docgen/src/custom_markdown_documenter.ts
@@ -69,6 +69,9 @@ import {
DocSection,
StandardTags,
StringBuilder,
+ DocHtmlStartTag,
+ DocHtmlEndTag,
+ DocHtmlAttribute,
type TSDocConfiguration,
} from '@microsoft/tsdoc';
import {
@@ -85,7 +88,7 @@ export interface IMarkdownDocumenterOptions {
export class CustomMarkdownEmitter extends ApiFormatterMarkdownEmitter {
protected override getEscapedText(text: string): string {
- const textWithBackslashes: string = text
+ const textWithBackslashes = text
.replace(/\\/g, '\\\\') // first replace the escape character
.replace(/[*#[\]_|`~]/g, x => {
return '\\' + x;
@@ -98,15 +101,6 @@ export class CustomMarkdownEmitter extends ApiFormatterMarkdownEmitter {
.replace(/\}/g, '}');
return textWithBackslashes;
}
-
- protected override getTableEscapedText(text: string): string {
- return text
- .replace(/&/g, '&')
- .replace(/"/g, '"')
- .replace(/</g, '&lt;')
- .replace(/>/g, '&gt;')
- .replace(/\|/g, '&#124;');
- }
}
/**
@@ -156,12 +150,12 @@ export class MarkdownDocumenter {
}
private _writeApiItemPage(apiItem: ApiItem): void {
- const configuration: TSDocConfiguration = this._tsdocConfiguration;
- const output: DocSection = new DocSection({
- configuration: this._tsdocConfiguration,
+ const configuration = this._tsdocConfiguration;
+ const output = new DocSection({
+ configuration,
});
- const scopedName: string = apiItem.getScopedNameWithinPackage();
+ const scopedName = apiItem.getScopedNameWithinPackage();
switch (apiItem.kind) {
case ApiItemKind.Class:
@@ -259,7 +253,7 @@ export class MarkdownDocumenter {
new DocNoteBox({configuration: this._tsdocConfiguration}, [
new DocParagraph({configuration: this._tsdocConfiguration}, [
new DocPlainText({
- configuration: this._tsdocConfiguration,
+ configuration,
text: 'Warning: This API is now obsolete. ',
}),
]),
@@ -369,11 +363,11 @@ export class MarkdownDocumenter {
this._writeRemarksSection(output, apiItem);
}
- const filename: string = path.join(
+ const filename = path.join(
this._outputFolder,
this._getFilenameForApiItem(apiItem)
);
- const stringBuilder: StringBuilder = new StringBuilder();
+ const stringBuilder = new StringBuilder();
this._markdownEmitter.emit(stringBuilder, output, {
contextApiItem: apiItem,
@@ -382,7 +376,7 @@ export class MarkdownDocumenter {
},
});
- let pageContent: string = stringBuilder.toString();
+ let pageContent = stringBuilder.toString();
if (this._pluginLoader.markdownDocumenterFeature) {
// Allow the plugin to customize the pageContent
@@ -413,18 +407,15 @@ export class MarkdownDocumenter {
output: DocSection,
apiItem: ApiDeclaredItem
): void {
- const configuration: TSDocConfiguration = this._tsdocConfiguration;
+ const configuration = this._tsdocConfiguration;
if (apiItem instanceof ApiClass) {
if (apiItem.extendsType) {
- const extendsParagraph: DocParagraph = new DocParagraph(
- {configuration},
- [
- new DocEmphasisSpan({configuration, bold: true}, [
- new DocPlainText({configuration, text: 'Extends: '}),
- ]),
- ]
- );
+ const extendsParagraph = new DocParagraph({configuration}, [
+ new DocEmphasisSpan({configuration, bold: true}, [
+ new DocPlainText({configuration, text: 'Extends: '}),
+ ]),
+ ]);
this._appendExcerptWithHyperlinks(
extendsParagraph,
apiItem.extendsType.excerpt
@@ -432,14 +423,11 @@ export class MarkdownDocumenter {
output.appendNode(extendsParagraph);
}
if (apiItem.implementsTypes.length > 0) {
- const extendsParagraph: DocParagraph = new DocParagraph(
- {configuration},
- [
- new DocEmphasisSpan({configuration, bold: true}, [
- new DocPlainText({configuration, text: 'Implements: '}),
- ]),
- ]
- );
+ const extendsParagraph = new DocParagraph({configuration}, [
+ new DocEmphasisSpan({configuration, bold: true}, [
+ new DocPlainText({configuration, text: 'Implements: '}),
+ ]),
+ ]);
let needsComma = false;
for (const implementsType of apiItem.implementsTypes) {
if (needsComma) {
@@ -459,14 +447,11 @@ export class MarkdownDocumenter {
if (apiItem instanceof ApiInterface) {
if (apiItem.extendsTypes.length > 0) {
- const extendsParagraph: DocParagraph = new DocParagraph(
- {configuration},
- [
- new DocEmphasisSpan({configuration, bold: true}, [
- new DocPlainText({configuration, text: 'Extends: '}),
- ]),
- ]
- );
+ const extendsParagraph = new DocParagraph({configuration}, [
+ new DocEmphasisSpan({configuration, bold: true}, [
+ new DocPlainText({configuration, text: 'Extends: '}),
+ ]),
+ ]);
let needsComma = false;
for (const extendsType of apiItem.extendsTypes) {
if (needsComma) {
@@ -496,14 +481,11 @@ export class MarkdownDocumenter {
);
});
if (refs.length > 0) {
- const referencesParagraph: DocParagraph = new DocParagraph(
- {configuration},
- [
- new DocEmphasisSpan({configuration, bold: true}, [
- new DocPlainText({configuration, text: 'References: '}),
- ]),
- ]
- );
+ const referencesParagraph = new DocParagraph({configuration}, [
+ new DocEmphasisSpan({configuration, bold: true}, [
+ new DocPlainText({configuration, text: 'References: '}),
+ ]),
+ ]);
let needsComma = false;
const visited = new Set<string>();
for (const ref of refs) {
@@ -548,6 +530,8 @@ export class MarkdownDocumenter {
}
private _writeRemarksSection(output: DocSection, apiItem: ApiItem): void {
+ const configuration = this._tsdocConfiguration;
+
if (apiItem instanceof ApiDocumentedItem) {
const tsdocComment: DocComment | undefined = apiItem.tsdocComment;
@@ -556,7 +540,7 @@ export class MarkdownDocumenter {
if (tsdocComment.remarksBlock) {
output.appendNode(
new DocHeading({
- configuration: this._tsdocConfiguration,
+ configuration,
title: 'Remarks',
})
);
@@ -580,7 +564,7 @@ export class MarkdownDocumenter {
output.appendNode(
new DocHeading({
- configuration: this._tsdocConfiguration,
+ configuration,
title: heading,
})
);
@@ -627,15 +611,15 @@ export class MarkdownDocumenter {
* GENERATE PAGE: MODEL
*/
private _writeModelTable(output: DocSection, apiModel: ApiModel): void {
- const configuration: TSDocConfiguration = this._tsdocConfiguration;
+ const configuration = this._tsdocConfiguration;
- const packagesTable: DocTable = new DocTable({
+ const packagesTable = new DocTable({
configuration,
headerTitles: ['Package', 'Description'],
});
for (const apiMember of apiModel.members) {
- const row: DocTableRow = new DocTableRow({configuration}, [
+ const row = new DocTableRow({configuration}, [
this._createTitleCell(apiMember),
this._createDescriptionCell(apiMember),
]);
@@ -651,7 +635,7 @@ export class MarkdownDocumenter {
if (packagesTable.rows.length > 0) {
output.appendNode(
new DocHeading({
- configuration: this._tsdocConfiguration,
+ configuration,
title: 'Packages',
})
);
@@ -666,39 +650,39 @@ export class MarkdownDocumenter {
output: DocSection,
apiContainer: ApiPackage | ApiNamespace
): void {
- const configuration: TSDocConfiguration = this._tsdocConfiguration;
+ const configuration = this._tsdocConfiguration;
- const classesTable: DocTable = new DocTable({
+ const classesTable = new DocTable({
configuration,
headerTitles: ['Class', 'Description'],
});
- const enumerationsTable: DocTable = new DocTable({
+ const enumerationsTable = new DocTable({
configuration,
headerTitles: ['Enumeration', 'Description'],
});
- const functionsTable: DocTable = new DocTable({
+ const functionsTable = new DocTable({
configuration,
headerTitles: ['Function', 'Description'],
});
- const interfacesTable: DocTable = new DocTable({
+ const interfacesTable = new DocTable({
configuration,
headerTitles: ['Interface', 'Description'],
});
- const namespacesTable: DocTable = new DocTable({
+ const namespacesTable = new DocTable({
configuration,
headerTitles: ['Namespace', 'Description'],
});
- const variablesTable: DocTable = new DocTable({
+ const variablesTable = new DocTable({
configuration,
headerTitles: ['Variable', 'Description'],
});
- const typeAliasesTable: DocTable = new DocTable({
+ const typeAliasesTable = new DocTable({
configuration,
headerTitles: ['Type Alias', 'Description'],
});
@@ -709,7 +693,7 @@ export class MarkdownDocumenter {
: (apiContainer as ApiNamespace).members;
for (const apiMember of apiMembers) {
- const row: DocTableRow = new DocTableRow({configuration}, [
+ const row = new DocTableRow({configuration}, [
this._createTitleCell(apiMember),
this._createDescriptionCell(apiMember),
]);
@@ -755,7 +739,7 @@ export class MarkdownDocumenter {
if (classesTable.rows.length > 0) {
output.appendNode(
new DocHeading({
- configuration: this._tsdocConfiguration,
+ configuration,
title: 'Classes',
})
);
@@ -765,7 +749,7 @@ export class MarkdownDocumenter {
if (enumerationsTable.rows.length > 0) {
output.appendNode(
new DocHeading({
- configuration: this._tsdocConfiguration,
+ configuration,
title: 'Enumerations',
})
);
@@ -774,7 +758,7 @@ export class MarkdownDocumenter {
if (functionsTable.rows.length > 0) {
output.appendNode(
new DocHeading({
- configuration: this._tsdocConfiguration,
+ configuration,
title: 'Functions',
})
);
@@ -784,7 +768,7 @@ export class MarkdownDocumenter {
if (interfacesTable.rows.length > 0) {
output.appendNode(
new DocHeading({
- configuration: this._tsdocConfiguration,
+ configuration,
title: 'Interfaces',
})
);
@@ -794,7 +778,7 @@ export class MarkdownDocumenter {
if (namespacesTable.rows.length > 0) {
output.appendNode(
new DocHeading({
- configuration: this._tsdocConfiguration,
+ configuration,
title: 'Namespaces',
})
);
@@ -804,7 +788,7 @@ export class MarkdownDocumenter {
if (variablesTable.rows.length > 0) {
output.appendNode(
new DocHeading({
- configuration: this._tsdocConfiguration,
+ configuration,
title: 'Variables',
})
);
@@ -814,7 +798,7 @@ export class MarkdownDocumenter {
if (typeAliasesTable.rows.length > 0) {
output.appendNode(
new DocHeading({
- configuration: this._tsdocConfiguration,
+ configuration,
title: 'Type Aliases',
})
);
@@ -826,24 +810,24 @@ export class MarkdownDocumenter {
* GENERATE PAGE: CLASS
*/
private _writeClassTables(output: DocSection, apiClass: ApiClass): void {
- const configuration: TSDocConfiguration = this._tsdocConfiguration;
+ const configuration = this._tsdocConfiguration;
- const eventsTable: DocTable = new DocTable({
+ const eventsTable = new DocTable({
configuration,
headerTitles: ['Property', 'Modifiers', 'Type', 'Description'],
});
- const constructorsTable: DocTable = new DocTable({
+ const constructorsTable = new DocTable({
configuration,
headerTitles: ['Constructor', 'Modifiers', 'Description'],
});
- const propertiesTable: DocTable = new DocTable({
+ const propertiesTable = new DocTable({
configuration,
headerTitles: ['Property', 'Modifiers', 'Type', 'Description'],
});
- const methodsTable: DocTable = new DocTable({
+ const methodsTable = new DocTable({
configuration,
headerTitles: ['Method', 'Modifiers', 'Description'],
});
@@ -902,7 +886,7 @@ export class MarkdownDocumenter {
if (eventsTable.rows.length > 0) {
output.appendNode(
new DocHeading({
- configuration: this._tsdocConfiguration,
+ configuration,
title: 'Events',
})
);
@@ -912,7 +896,7 @@ export class MarkdownDocumenter {
if (constructorsTable.rows.length > 0) {
output.appendNode(
new DocHeading({
- configuration: this._tsdocConfiguration,
+ configuration,
title: 'Constructors',
})
);
@@ -922,7 +906,7 @@ export class MarkdownDocumenter {
if (propertiesTable.rows.length > 0) {
output.appendNode(
new DocHeading({
- configuration: this._tsdocConfiguration,
+ configuration,
title: 'Properties',
})
);
@@ -932,7 +916,7 @@ export class MarkdownDocumenter {
if (methodsTable.rows.length > 0) {
output.appendNode(
new DocHeading({
- configuration: this._tsdocConfiguration,
+ configuration,
title: 'Methods',
})
);
@@ -944,9 +928,9 @@ export class MarkdownDocumenter {
* GENERATE PAGE: ENUM
*/
private _writeEnumTables(output: DocSection, apiEnum: ApiEnum): void {
- const configuration: TSDocConfiguration = this._tsdocConfiguration;
+ const configuration = this._tsdocConfiguration;
- const enumMembersTable: DocTable = new DocTable({
+ const enumMembersTable = new DocTable({
configuration,
headerTitles: ['Member', 'Value', 'Description'],
});
@@ -971,7 +955,7 @@ export class MarkdownDocumenter {
if (enumMembersTable.rows.length > 0) {
output.appendNode(
new DocHeading({
- configuration: this._tsdocConfiguration,
+ configuration,
title: 'Enumeration Members',
})
);
@@ -986,19 +970,19 @@ export class MarkdownDocumenter {
output: DocSection,
apiClass: ApiInterface
): void {
- const configuration: TSDocConfiguration = this._tsdocConfiguration;
+ const configuration = this._tsdocConfiguration;
- const eventsTable: DocTable = new DocTable({
+ const eventsTable = new DocTable({
configuration,
headerTitles: ['Property', 'Modifiers', 'Type', 'Description'],
});
- const propertiesTable: DocTable = new DocTable({
+ const propertiesTable = new DocTable({
configuration,
headerTitles: ['Property', 'Modifiers', 'Type', 'Description', 'Default'],
});
- const methodsTable: DocTable = new DocTable({
+ const methodsTable = new DocTable({
configuration,
headerTitles: ['Method', 'Description'],
});
@@ -1046,7 +1030,7 @@ export class MarkdownDocumenter {
if (eventsTable.rows.length > 0) {
output.appendNode(
new DocHeading({
- configuration: this._tsdocConfiguration,
+ configuration,
title: 'Events',
})
);
@@ -1056,7 +1040,7 @@ export class MarkdownDocumenter {
if (propertiesTable.rows.length > 0) {
output.appendNode(
new DocHeading({
- configuration: this._tsdocConfiguration,
+ configuration,
title: 'Properties',
})
);
@@ -1066,7 +1050,7 @@ export class MarkdownDocumenter {
if (methodsTable.rows.length > 0) {
output.appendNode(
new DocHeading({
- configuration: this._tsdocConfiguration,
+ configuration,
title: 'Methods',
})
);
@@ -1081,14 +1065,14 @@ export class MarkdownDocumenter {
output: DocSection,
apiParameterListMixin: ApiParameterListMixin
): void {
- const configuration: TSDocConfiguration = this._tsdocConfiguration;
+ const configuration = this._tsdocConfiguration;
- const parametersTable: DocTable = new DocTable({
+ const parametersTable = new DocTable({
configuration,
headerTitles: ['Parameter', 'Type', 'Description'],
});
for (const apiParameter of apiParameterListMixin.parameters) {
- const parameterDescription: DocSection = new DocSection({configuration});
+ const parameterDescription = new DocSection({configuration});
if (apiParameter.isOptional) {
parameterDescription.appendNodesInParagraph([
@@ -1126,7 +1110,7 @@ export class MarkdownDocumenter {
if (parametersTable.rows.length > 0) {
output.appendNode(
new DocHeading({
- configuration: this._tsdocConfiguration,
+ configuration,
title: 'Parameters',
})
);
@@ -1161,9 +1145,9 @@ export class MarkdownDocumenter {
}
private _createParagraphForTypeExcerpt(excerpt: Excerpt): DocParagraph {
- const configuration: TSDocConfiguration = this._tsdocConfiguration;
+ const configuration = this._tsdocConfiguration;
- const paragraph: DocParagraph = new DocParagraph({configuration});
+ const paragraph = new DocParagraph({configuration});
if (!excerpt.text.trim()) {
paragraph.appendNode(
new DocPlainText({configuration, text: '(not declared)'})
@@ -1188,13 +1172,13 @@ export class MarkdownDocumenter {
docNodeContainer: DocNodeContainer,
token: ExcerptToken
): void {
- const configuration: TSDocConfiguration = this._tsdocConfiguration;
+ const configuration = this._tsdocConfiguration;
// Markdown doesn't provide a standardized syntax for hyperlinks inside code
// spans, so we will render the type expression as DocPlainText. Instead of
// creating multiple DocParagraphs, we can simply discard any newlines and
// let the renderer do normal word-wrapping.
- const unwrappedTokenText: string = token.text.replace(/[\r\n]+/g, ' ');
+ const unwrappedTokenText = token.text.replace(/[\r\n]+/g, ' ');
// If it's hyperlinkable, then append a DocLinkTag
if (token.kind === ExcerptTokenKind.Reference && token.canonicalReference) {
@@ -1226,12 +1210,23 @@ export class MarkdownDocumenter {
}
private _createTitleCell(apiItem: ApiItem, plain = false): DocTableCell {
- const configuration: TSDocConfiguration = this._tsdocConfiguration;
+ const configuration = this._tsdocConfiguration;
- const text: string = Utilities.getConciseSignature(apiItem);
+ const text = Utilities.getConciseSignature(apiItem);
return new DocTableCell({configuration}, [
new DocParagraph({configuration}, [
+ new DocHtmlStartTag({
+ configuration,
+ name: 'span',
+ htmlAttributes: [
+ new DocHtmlAttribute({
+ configuration,
+ name: 'id',
+ value: `"${Utilities.getSafeFilenameForName(apiItem.displayName)}"`,
+ }),
+ ],
+ }),
plain
? new DocPlainText({configuration, text})
: new DocLinkTag({
@@ -1240,6 +1235,10 @@ export class MarkdownDocumenter {
linkText: text,
urlDestination: this._getLinkFilenameForApiItem(apiItem),
}),
+ new DocHtmlEndTag({
+ configuration,
+ name: 'span',
+ }),
]),
]);
}
@@ -1254,9 +1253,9 @@ export class MarkdownDocumenter {
* cast.
*/
private _createDescriptionCell(apiItem: ApiItem): DocTableCell {
- const configuration: TSDocConfiguration = this._tsdocConfiguration;
+ const configuration = this._tsdocConfiguration;
- const section: DocSection = new DocSection({configuration});
+ const section = new DocSection({configuration});
if (ApiReleaseTagMixin.isBaseClassOf(apiItem)) {
if (apiItem.releaseTag === ReleaseTag.Beta) {
@@ -1275,6 +1274,20 @@ export class MarkdownDocumenter {
section,
apiItem.tsdocComment.summarySection
);
+
+ if (apiItem.tsdocComment.deprecatedBlock) {
+ section.appendNode(
+ new DocParagraph({configuration}, [
+ new DocEmphasisSpan({configuration, bold: true}, [
+ new DocPlainText({configuration, text: 'Deprecated: '}),
+ ]),
+ ])
+ );
+
+ section.appendNodes(
+ apiItem.tsdocComment.deprecatedBlock.content.getChildNodes()
+ );
+ }
}
}
@@ -1282,7 +1295,7 @@ export class MarkdownDocumenter {
}
private _createDefaultCell(apiItem: ApiItem): DocTableCell {
- const configuration: TSDocConfiguration = this._tsdocConfiguration;
+ const configuration = this._tsdocConfiguration;
if (apiItem instanceof ApiDocumentedItem) {
const block = apiItem.tsdocComment?.customBlocks.find(block => {
@@ -1300,57 +1313,56 @@ export class MarkdownDocumenter {
}
private _createModifiersCell(apiItem: ApiItem): DocTableCell {
- const configuration: TSDocConfiguration = this._tsdocConfiguration;
+ const configuration = this._tsdocConfiguration;
+
+ const section = new DocSection({configuration});
- const section: DocSection = new DocSection({configuration});
+ const codes = [];
if (ApiProtectedMixin.isBaseClassOf(apiItem)) {
if (apiItem.isProtected) {
- section.appendNode(
- new DocParagraph({configuration}, [
- new DocCodeSpan({configuration, code: 'protected'}),
- ])
- );
+ codes.push('protected');
}
}
if (ApiReadonlyMixin.isBaseClassOf(apiItem)) {
if (apiItem.isReadonly) {
- section.appendNode(
- new DocParagraph({configuration}, [
- new DocCodeSpan({configuration, code: 'readonly'}),
- ])
- );
+ codes.push('readonly');
}
}
if (ApiStaticMixin.isBaseClassOf(apiItem)) {
if (apiItem.isStatic) {
- section.appendNode(
- new DocParagraph({configuration}, [
- new DocCodeSpan({configuration, code: 'static'}),
- ])
- );
+ codes.push('static');
}
}
if (ApiOptionalMixin.isBaseClassOf(apiItem)) {
if (apiItem.isOptional) {
- section.appendNode(
- new DocParagraph({configuration}, [
- new DocCodeSpan({configuration, code: 'optional'}),
- ])
- );
+ codes.push('optional');
}
}
+ if (apiItem instanceof ApiDocumentedItem) {
+ if (apiItem.tsdocComment?.deprecatedBlock) {
+ codes.push('deprecated');
+ }
+ }
+ if (codes.length) {
+ section.appendNode(
+ new DocParagraph({configuration}, [
+ new DocCodeSpan({configuration, code: codes.join(', ')}),
+ ])
+ );
+ }
+
return new DocTableCell({configuration}, section.nodes);
}
private _createPropertyTypeCell(apiItem: ApiItem): DocTableCell {
- const configuration: TSDocConfiguration = this._tsdocConfiguration;
+ const configuration = this._tsdocConfiguration;
- const section: DocSection = new DocSection({configuration});
+ const section = new DocSection({configuration});
if (apiItem instanceof ApiPropertyItem) {
section.appendNode(
@@ -1362,9 +1374,9 @@ export class MarkdownDocumenter {
}
private _createInitializerCell(apiItem: ApiItem): DocTableCell {
- const configuration: TSDocConfiguration = this._tsdocConfiguration;
+ const configuration = this._tsdocConfiguration;
- const section: DocSection = new DocSection({configuration});
+ const section = new DocSection({configuration});
if (ApiInitializerMixin.isBaseClassOf(apiItem)) {
if (apiItem.initializerExcerpt) {
@@ -1381,8 +1393,8 @@ export class MarkdownDocumenter {
}
private _writeBetaWarning(output: DocSection): void {
- const configuration: TSDocConfiguration = this._tsdocConfiguration;
- const betaWarning: string =
+ const configuration = this._tsdocConfiguration;
+ const betaWarning =
'This API is provided as a preview for developers and may change' +
' based on feedback that we receive. Do not use this API in a production environment.';
output.appendNode(
@@ -1427,7 +1439,7 @@ export class MarkdownDocumenter {
let baseName = '';
for (const hierarchyItem of apiItem.getHierarchy()) {
// For overloaded methods, add a suffix such as "MyClass.myMethod_2".
- let qualifiedName: string = hierarchyItem.displayName;
+ let qualifiedName = hierarchyItem.displayName;
if (ApiParameterListMixin.isBaseClassOf(hierarchyItem)) {
if (hierarchyItem.overloadIndex > 1) {
// Subtract one for compatibility with earlier releases of API Documenter.
@@ -1448,15 +1460,16 @@ export class MarkdownDocumenter {
return baseName.slice(0, baseName.length - 1);
}
- private _getFilenameForApiItem(apiItem: ApiItem): string {
+ private _getFilenameForApiItem(apiItem: ApiItem, link = false): string {
if (apiItem.kind === ApiItemKind.Package) {
return 'index.md';
}
let baseName = '';
+ let suffix = '';
for (const hierarchyItem of apiItem.getHierarchy()) {
// For overloaded methods, add a suffix such as "MyClass.myMethod_2".
- let qualifiedName: string = Utilities.getSafeFilenameForName(
+ let qualifiedName = Utilities.getSafeFilenameForName(
hierarchyItem.displayName
);
if (ApiParameterListMixin.isBaseClassOf(hierarchyItem)) {
@@ -1471,6 +1484,9 @@ export class MarkdownDocumenter {
case ApiItemKind.Model:
case ApiItemKind.EntryPoint:
case ApiItemKind.EnumMember:
+ // Properties don't have separate pages
+ case ApiItemKind.Property:
+ case ApiItemKind.PropertySignature:
break;
case ApiItemKind.Package:
baseName = Utilities.getSafeFilenameForName(
@@ -1480,12 +1496,26 @@ export class MarkdownDocumenter {
default:
baseName += '.' + qualifiedName;
}
+
+ if (link) {
+ switch (hierarchyItem.kind) {
+ case ApiItemKind.Property:
+ case ApiItemKind.PropertySignature:
+ suffix =
+ '#' +
+ Utilities.getSafeFilenameForName(
+ PackageName.getUnscopedName(hierarchyItem.displayName)
+ );
+ break;
+ }
+ }
}
- return baseName + '.md';
+
+ return `${baseName}.md${suffix}`;
}
private _getLinkFilenameForApiItem(apiItem: ApiItem): string {
- return './' + this._getFilenameForApiItem(apiItem);
+ return './' + this._getFilenameForApiItem(apiItem, true);
}
private _deleteOldOutputFiles(): void {