@firebase/api-documenter 0.1.2-canary.233e117f0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +16 -0
- package/dist/cli/ApiDocumenterCommandLine.d.ts +22 -0
- package/dist/cli/ApiDocumenterCommandLine.js +44 -0
- package/dist/cli/ApiDocumenterCommandLine.js.map +1 -0
- package/dist/cli/BaseAction.d.ts +37 -0
- package/dist/cli/BaseAction.js +125 -0
- package/dist/cli/BaseAction.js.map +1 -0
- package/dist/cli/MarkdownAction.d.ts +22 -0
- package/dist/cli/MarkdownAction.js +47 -0
- package/dist/cli/MarkdownAction.js.map +1 -0
- package/dist/cli/TocAction.d.ts +25 -0
- package/dist/cli/TocAction.js +67 -0
- package/dist/cli/TocAction.js.map +1 -0
- package/dist/documenters/DocumenterConfig.d.ts +45 -0
- package/dist/documenters/DocumenterConfig.js +63 -0
- package/dist/documenters/DocumenterConfig.js.map +1 -0
- package/dist/documenters/IConfigFile.d.ts +98 -0
- package/dist/documenters/IConfigFile.js +19 -0
- package/dist/documenters/IConfigFile.js.map +1 -0
- package/dist/documenters/MarkdownDocumenter.d.ts +75 -0
- package/dist/documenters/MarkdownDocumenter.js +750 -0
- package/dist/documenters/MarkdownDocumenter.js.map +1 -0
- package/dist/documenters/MarkdownDocumenterHelpers.d.ts +40 -0
- package/dist/documenters/MarkdownDocumenterHelpers.js +306 -0
- package/dist/documenters/MarkdownDocumenterHelpers.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/markdown/CustomMarkdownEmitter.d.ts +32 -0
- package/dist/markdown/CustomMarkdownEmitter.js +161 -0
- package/dist/markdown/CustomMarkdownEmitter.js.map +1 -0
- package/dist/markdown/MarkdownEmitter.d.ts +48 -0
- package/dist/markdown/MarkdownEmitter.js +243 -0
- package/dist/markdown/MarkdownEmitter.js.map +1 -0
- package/dist/markdown/test/CustomMarkdownEmitter.test.d.ts +17 -0
- package/dist/markdown/test/CustomMarkdownEmitter.test.js +205 -0
- package/dist/markdown/test/CustomMarkdownEmitter.test.js.map +1 -0
- package/dist/nodes/CustomDocNodeKind.d.ts +32 -0
- package/dist/nodes/CustomDocNodeKind.js +58 -0
- package/dist/nodes/CustomDocNodeKind.js.map +1 -0
- package/dist/nodes/DocEmphasisSpan.d.ts +35 -0
- package/dist/nodes/DocEmphasisSpan.js +39 -0
- package/dist/nodes/DocEmphasisSpan.js.map +1 -0
- package/dist/nodes/DocHeading.d.ts +38 -0
- package/dist/nodes/DocHeading.js +45 -0
- package/dist/nodes/DocHeading.js.map +1 -0
- package/dist/nodes/DocNoteBox.d.ts +33 -0
- package/dist/nodes/DocNoteBox.js +41 -0
- package/dist/nodes/DocNoteBox.js.map +1 -0
- package/dist/nodes/DocTable.d.ts +41 -0
- package/dist/nodes/DocTable.js +77 -0
- package/dist/nodes/DocTable.js.map +1 -0
- package/dist/nodes/DocTableCell.d.ts +31 -0
- package/dist/nodes/DocTableCell.js +37 -0
- package/dist/nodes/DocTableCell.js.map +1 -0
- package/dist/nodes/DocTableRow.d.ts +38 -0
- package/dist/nodes/DocTableRow.js +68 -0
- package/dist/nodes/DocTableRow.js.map +1 -0
- package/dist/plugin/IApiDocumenterPluginManifest.d.ts +85 -0
- package/dist/plugin/IApiDocumenterPluginManifest.js +19 -0
- package/dist/plugin/IApiDocumenterPluginManifest.js.map +1 -0
- package/dist/plugin/MarkdownDocumenterAccessor.d.ts +41 -0
- package/dist/plugin/MarkdownDocumenterAccessor.js +44 -0
- package/dist/plugin/MarkdownDocumenterAccessor.js.map +1 -0
- package/dist/plugin/MarkdownDocumenterFeature.d.ts +88 -0
- package/dist/plugin/MarkdownDocumenterFeature.js +66 -0
- package/dist/plugin/MarkdownDocumenterFeature.js.map +1 -0
- package/dist/plugin/PluginFeature.d.ts +61 -0
- package/dist/plugin/PluginFeature.js +76 -0
- package/dist/plugin/PluginFeature.js.map +1 -0
- package/dist/plugin/PluginLoader.d.ts +22 -0
- package/dist/plugin/PluginLoader.js +100 -0
- package/dist/plugin/PluginLoader.js.map +1 -0
- package/dist/schemas/api-documenter-template.json +92 -0
- package/dist/schemas/api-documenter.schema.json +42 -0
- package/dist/start.d.ts +18 -0
- package/dist/start.js +32 -0
- package/dist/start.js.map +1 -0
- package/dist/toc.d.ts +25 -0
- package/dist/toc.js +61 -0
- package/dist/toc.js.map +1 -0
- package/dist/utils/IndentedWriter.d.ts +116 -0
- package/dist/utils/IndentedWriter.js +213 -0
- package/dist/utils/IndentedWriter.js.map +1 -0
- package/dist/utils/Utilities.d.ts +28 -0
- package/dist/utils/Utilities.js +47 -0
- package/dist/utils/Utilities.js.map +1 -0
- package/dist/utils/test/IndentedWriter.test.d.ts +17 -0
- package/dist/utils/test/IndentedWriter.test.js +87 -0
- package/dist/utils/test/IndentedWriter.test.js.map +1 -0
- package/package.json +38 -0
|
@@ -0,0 +1,750 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2020 Google LLC
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.MarkdownDocumenter = void 0;
|
|
20
|
+
const tslib_1 = require("tslib");
|
|
21
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
22
|
+
// See LICENSE in the project root for license information.
|
|
23
|
+
const node_core_library_1 = require("@rushstack/node-core-library");
|
|
24
|
+
const tsdoc_1 = require("@microsoft/tsdoc");
|
|
25
|
+
const api_extractor_model_me_1 = require("api-extractor-model-me");
|
|
26
|
+
const CustomDocNodeKind_1 = require("../nodes/CustomDocNodeKind");
|
|
27
|
+
const CustomMarkdownEmitter_1 = require("../markdown/CustomMarkdownEmitter");
|
|
28
|
+
const PluginLoader_1 = require("../plugin/PluginLoader");
|
|
29
|
+
const MarkdownDocumenterFeature_1 = require("../plugin/MarkdownDocumenterFeature");
|
|
30
|
+
const MarkdownDocumenterAccessor_1 = require("../plugin/MarkdownDocumenterAccessor");
|
|
31
|
+
const MarkdownDocumenterHelpers_1 = require("./MarkdownDocumenterHelpers");
|
|
32
|
+
const path = tslib_1.__importStar(require("path"));
|
|
33
|
+
const DocHeading_1 = require("../nodes/DocHeading");
|
|
34
|
+
const DocNoteBox_1 = require("../nodes/DocNoteBox");
|
|
35
|
+
const DocTable_1 = require("../nodes/DocTable");
|
|
36
|
+
const DocTableRow_1 = require("../nodes/DocTableRow");
|
|
37
|
+
const DocTableCell_1 = require("../nodes/DocTableCell");
|
|
38
|
+
const DocEmphasisSpan_1 = require("../nodes/DocEmphasisSpan");
|
|
39
|
+
/**
|
|
40
|
+
* Renders API documentation in the Markdown file format.
|
|
41
|
+
* For more info: https://en.wikipedia.org/wiki/Markdown
|
|
42
|
+
*/
|
|
43
|
+
class MarkdownDocumenter {
|
|
44
|
+
constructor(options) {
|
|
45
|
+
this._apiModel = options.apiModel;
|
|
46
|
+
this._documenterConfig = options.documenterConfig;
|
|
47
|
+
this._outputFolder = options.outputFolder;
|
|
48
|
+
this._addFileNameSuffix = options.addFileNameSuffix;
|
|
49
|
+
this._tsdocConfiguration = CustomDocNodeKind_1.CustomDocNodes.configuration;
|
|
50
|
+
this._markdownEmitter = new CustomMarkdownEmitter_1.CustomMarkdownEmitter(this._apiModel);
|
|
51
|
+
this._pluginLoader = new PluginLoader_1.PluginLoader();
|
|
52
|
+
}
|
|
53
|
+
generateFiles() {
|
|
54
|
+
if (this._documenterConfig) {
|
|
55
|
+
this._pluginLoader.load(this._documenterConfig, () => {
|
|
56
|
+
return new MarkdownDocumenterFeature_1.MarkdownDocumenterFeatureContext({
|
|
57
|
+
apiModel: this._apiModel,
|
|
58
|
+
outputFolder: this._outputFolder,
|
|
59
|
+
documenter: new MarkdownDocumenterAccessor_1.MarkdownDocumenterAccessor({
|
|
60
|
+
getLinkForApiItem: (apiItem) => {
|
|
61
|
+
return MarkdownDocumenterHelpers_1.getLinkForApiItem(apiItem, this._addFileNameSuffix);
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
this._deleteOldOutputFiles();
|
|
68
|
+
this._writeApiItemPage(this._apiModel);
|
|
69
|
+
if (this._pluginLoader.markdownDocumenterFeature) {
|
|
70
|
+
this._pluginLoader.markdownDocumenterFeature.onFinished({});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
_writeApiItemPage(apiItem) {
|
|
74
|
+
const output = new tsdoc_1.DocSection({
|
|
75
|
+
configuration: this._tsdocConfiguration
|
|
76
|
+
});
|
|
77
|
+
const nodes = this._createCompleteOutputForApiItem(apiItem);
|
|
78
|
+
/**
|
|
79
|
+
* Remove the heading of the page from md output. (the first item is always a DocHeading)
|
|
80
|
+
* Later we will add the heading to the devsite header {% block title %}
|
|
81
|
+
*/
|
|
82
|
+
const headingNode = nodes[0];
|
|
83
|
+
const pageWithoutHeading = nodes.slice(1);
|
|
84
|
+
output.appendNodes(pageWithoutHeading);
|
|
85
|
+
// write to file
|
|
86
|
+
const filename = path.join(this._outputFolder, MarkdownDocumenterHelpers_1.getFilenameForApiItem(apiItem, this._addFileNameSuffix));
|
|
87
|
+
const stringBuilder = new tsdoc_1.StringBuilder();
|
|
88
|
+
// devsite headers
|
|
89
|
+
stringBuilder.append('{% extends "_internal/templates/reference.html" %}\n');
|
|
90
|
+
stringBuilder.append(`{% block title %}${headingNode.title}{% endblock title %}\n`);
|
|
91
|
+
stringBuilder.append('{% block body %}\n');
|
|
92
|
+
this._markdownEmitter.emit(stringBuilder, output, {
|
|
93
|
+
contextApiItem: apiItem,
|
|
94
|
+
onGetFilenameForApiItem: (apiItemForFilename) => {
|
|
95
|
+
return MarkdownDocumenterHelpers_1.getLinkForApiItem(apiItemForFilename, this._addFileNameSuffix);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
stringBuilder.append('{% endblock body %}\n');
|
|
99
|
+
let pageContent = stringBuilder.toString();
|
|
100
|
+
if (this._pluginLoader.markdownDocumenterFeature) {
|
|
101
|
+
// Allow the plugin to customize the pageContent
|
|
102
|
+
const eventArgs = {
|
|
103
|
+
apiItem: apiItem,
|
|
104
|
+
outputFilename: filename,
|
|
105
|
+
pageContent: pageContent
|
|
106
|
+
};
|
|
107
|
+
this._pluginLoader.markdownDocumenterFeature.onBeforeWritePage(eventArgs);
|
|
108
|
+
pageContent = eventArgs.pageContent;
|
|
109
|
+
}
|
|
110
|
+
node_core_library_1.FileSystem.writeFile(filename, pageContent, {
|
|
111
|
+
convertLineEndings: "\n" /* Lf */
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
_createCompleteOutputForApiItem(apiItem) {
|
|
115
|
+
const configuration = this._tsdocConfiguration;
|
|
116
|
+
const output = [];
|
|
117
|
+
const scopedName = apiItem.getScopedNameWithinPackage();
|
|
118
|
+
switch (apiItem.kind) {
|
|
119
|
+
case "Class" /* Class */:
|
|
120
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: `${scopedName} class` }));
|
|
121
|
+
break;
|
|
122
|
+
case "Enum" /* Enum */:
|
|
123
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: `${scopedName}` }));
|
|
124
|
+
break;
|
|
125
|
+
case "Interface" /* Interface */:
|
|
126
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: `${scopedName} interface` }));
|
|
127
|
+
break;
|
|
128
|
+
case "Constructor" /* Constructor */:
|
|
129
|
+
case "ConstructSignature" /* ConstructSignature */:
|
|
130
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: scopedName }));
|
|
131
|
+
break;
|
|
132
|
+
case "Method" /* Method */:
|
|
133
|
+
case "MethodSignature" /* MethodSignature */:
|
|
134
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: `${scopedName}` }));
|
|
135
|
+
break;
|
|
136
|
+
case "Function" /* Function */:
|
|
137
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: `${scopedName}` }));
|
|
138
|
+
break;
|
|
139
|
+
case "Model" /* Model */:
|
|
140
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: `API Reference` }));
|
|
141
|
+
break;
|
|
142
|
+
case "Namespace" /* Namespace */:
|
|
143
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: `${scopedName} namespace` }));
|
|
144
|
+
break;
|
|
145
|
+
case "Package" /* Package */:
|
|
146
|
+
const unscopedPackageName = node_core_library_1.PackageName.getUnscopedName(apiItem.displayName);
|
|
147
|
+
output.push(new DocHeading_1.DocHeading({
|
|
148
|
+
configuration,
|
|
149
|
+
title: `${unscopedPackageName} package`
|
|
150
|
+
}));
|
|
151
|
+
break;
|
|
152
|
+
case "EntryPoint" /* EntryPoint */:
|
|
153
|
+
const packageName = apiItem.parent.displayName;
|
|
154
|
+
output.push(new DocHeading_1.DocHeading({
|
|
155
|
+
configuration,
|
|
156
|
+
title: `${packageName}${apiItem.displayName && '/' + apiItem.displayName}`
|
|
157
|
+
}));
|
|
158
|
+
break;
|
|
159
|
+
case "Property" /* Property */:
|
|
160
|
+
case "PropertySignature" /* PropertySignature */:
|
|
161
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: `${scopedName}` }));
|
|
162
|
+
break;
|
|
163
|
+
case "TypeAlias" /* TypeAlias */:
|
|
164
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: `${scopedName}` }));
|
|
165
|
+
break;
|
|
166
|
+
case "Variable" /* Variable */:
|
|
167
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: `${scopedName}` }));
|
|
168
|
+
break;
|
|
169
|
+
default:
|
|
170
|
+
throw new Error('Unsupported API item kind:1 ' + apiItem.kind);
|
|
171
|
+
}
|
|
172
|
+
if (api_extractor_model_me_1.ApiReleaseTagMixin.isBaseClassOf(apiItem)) {
|
|
173
|
+
if (apiItem.releaseTag === api_extractor_model_me_1.ReleaseTag.Beta) {
|
|
174
|
+
output.push(MarkdownDocumenterHelpers_1.createBetaWarning(configuration));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (apiItem instanceof api_extractor_model_me_1.ApiDocumentedItem) {
|
|
178
|
+
const tsdocComment = apiItem.tsdocComment;
|
|
179
|
+
if (tsdocComment) {
|
|
180
|
+
if (tsdocComment.deprecatedBlock) {
|
|
181
|
+
output.push(new DocNoteBox_1.DocNoteBox({ configuration }, [
|
|
182
|
+
new tsdoc_1.DocParagraph({ configuration }, [
|
|
183
|
+
new tsdoc_1.DocPlainText({
|
|
184
|
+
configuration,
|
|
185
|
+
text: 'Warning: This API is now obsolete. '
|
|
186
|
+
})
|
|
187
|
+
]),
|
|
188
|
+
...tsdocComment.deprecatedBlock.content.nodes
|
|
189
|
+
]));
|
|
190
|
+
}
|
|
191
|
+
output.push(...tsdocComment.summarySection.nodes);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
// render remark sections
|
|
195
|
+
output.push(...MarkdownDocumenterHelpers_1.createRemarksSection(apiItem, configuration));
|
|
196
|
+
if (apiItem instanceof api_extractor_model_me_1.ApiDeclaredItem) {
|
|
197
|
+
output.push(...this._createSignatureSection(apiItem));
|
|
198
|
+
}
|
|
199
|
+
switch (apiItem.kind) {
|
|
200
|
+
case "Class" /* Class */:
|
|
201
|
+
output.push(...this._createClassTables(apiItem));
|
|
202
|
+
break;
|
|
203
|
+
case "Enum" /* Enum */:
|
|
204
|
+
output.push(...MarkdownDocumenterHelpers_1.createEnumTables(apiItem, configuration));
|
|
205
|
+
break;
|
|
206
|
+
case "Interface" /* Interface */:
|
|
207
|
+
output.push(...this._createInterfaceTables(apiItem));
|
|
208
|
+
break;
|
|
209
|
+
case "Constructor" /* Constructor */:
|
|
210
|
+
case "ConstructSignature" /* ConstructSignature */:
|
|
211
|
+
case "Method" /* Method */:
|
|
212
|
+
case "MethodSignature" /* MethodSignature */:
|
|
213
|
+
case "Function" /* Function */:
|
|
214
|
+
output.push(...this._createParameterTables(apiItem));
|
|
215
|
+
output.push(...MarkdownDocumenterHelpers_1.createThrowsSection(apiItem, configuration));
|
|
216
|
+
break;
|
|
217
|
+
case "Namespace" /* Namespace */:
|
|
218
|
+
output.push(...this._createEntryPointOrNamespace(apiItem));
|
|
219
|
+
break;
|
|
220
|
+
case "Model" /* Model */:
|
|
221
|
+
output.push(...this._createModelTable(apiItem));
|
|
222
|
+
break;
|
|
223
|
+
case "Package" /* Package */:
|
|
224
|
+
output.push(...this._createPackage(apiItem));
|
|
225
|
+
break;
|
|
226
|
+
case "EntryPoint" /* EntryPoint */:
|
|
227
|
+
output.push(...this._createEntryPointOrNamespace(apiItem));
|
|
228
|
+
break;
|
|
229
|
+
case "Property" /* Property */:
|
|
230
|
+
case "PropertySignature" /* PropertySignature */:
|
|
231
|
+
break;
|
|
232
|
+
case "TypeAlias" /* TypeAlias */:
|
|
233
|
+
break;
|
|
234
|
+
case "Variable" /* Variable */:
|
|
235
|
+
break;
|
|
236
|
+
default:
|
|
237
|
+
throw new Error('Unsupported API item kind:2 ' + apiItem.kind);
|
|
238
|
+
}
|
|
239
|
+
output.push(...MarkdownDocumenterHelpers_1.createExampleSection(apiItem, configuration));
|
|
240
|
+
return output;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* GENERATE PAGE: CLASS
|
|
244
|
+
*
|
|
245
|
+
* TODO: generate member references in the same page
|
|
246
|
+
*/
|
|
247
|
+
_createClassTables(apiClass) {
|
|
248
|
+
const configuration = this._tsdocConfiguration;
|
|
249
|
+
const output = [];
|
|
250
|
+
const eventsTable = new DocTable_1.DocTable({
|
|
251
|
+
configuration,
|
|
252
|
+
headerTitles: ['Property', 'Modifiers', 'Type', 'Description']
|
|
253
|
+
});
|
|
254
|
+
const constructorsTable = new DocTable_1.DocTable({
|
|
255
|
+
configuration,
|
|
256
|
+
headerTitles: ['Constructor', 'Modifiers', 'Description']
|
|
257
|
+
});
|
|
258
|
+
const propertiesTable = new DocTable_1.DocTable({
|
|
259
|
+
configuration,
|
|
260
|
+
headerTitles: ['Property', 'Modifiers', 'Type', 'Description']
|
|
261
|
+
});
|
|
262
|
+
const methodsTable = new DocTable_1.DocTable({
|
|
263
|
+
configuration,
|
|
264
|
+
headerTitles: ['Method', 'Modifiers', 'Description']
|
|
265
|
+
});
|
|
266
|
+
const constructorsDefinitions = [];
|
|
267
|
+
const methodsDefinitions = [];
|
|
268
|
+
const propertiesDefinitions = [];
|
|
269
|
+
const eventsDefinitions = [];
|
|
270
|
+
for (const apiMember of apiClass.members) {
|
|
271
|
+
switch (apiMember.kind) {
|
|
272
|
+
case "Constructor" /* Constructor */: {
|
|
273
|
+
constructorsTable.addRow(new DocTableRow_1.DocTableRow({ configuration }, [
|
|
274
|
+
MarkdownDocumenterHelpers_1.createTitleCell(apiMember, configuration, this._addFileNameSuffix),
|
|
275
|
+
MarkdownDocumenterHelpers_1.createModifiersCell(apiMember, configuration),
|
|
276
|
+
MarkdownDocumenterHelpers_1.createDescriptionCell(apiMember, configuration)
|
|
277
|
+
]));
|
|
278
|
+
constructorsDefinitions.push(...this._createCompleteOutputForApiItem(apiMember));
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
281
|
+
case "Method" /* Method */: {
|
|
282
|
+
methodsTable.addRow(new DocTableRow_1.DocTableRow({ configuration }, [
|
|
283
|
+
MarkdownDocumenterHelpers_1.createTitleCell(apiMember, configuration, this._addFileNameSuffix),
|
|
284
|
+
MarkdownDocumenterHelpers_1.createModifiersCell(apiMember, configuration),
|
|
285
|
+
MarkdownDocumenterHelpers_1.createDescriptionCell(apiMember, configuration)
|
|
286
|
+
]));
|
|
287
|
+
methodsDefinitions.push(...this._createCompleteOutputForApiItem(apiMember));
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
case "Property" /* Property */: {
|
|
291
|
+
if (apiMember.isEventProperty) {
|
|
292
|
+
eventsTable.addRow(new DocTableRow_1.DocTableRow({ configuration }, [
|
|
293
|
+
MarkdownDocumenterHelpers_1.createTitleCell(apiMember, configuration, this._addFileNameSuffix),
|
|
294
|
+
MarkdownDocumenterHelpers_1.createModifiersCell(apiMember, configuration),
|
|
295
|
+
this._createPropertyTypeCell(apiMember),
|
|
296
|
+
MarkdownDocumenterHelpers_1.createDescriptionCell(apiMember, configuration)
|
|
297
|
+
]));
|
|
298
|
+
eventsDefinitions.push(...this._createCompleteOutputForApiItem(apiMember));
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
propertiesTable.addRow(new DocTableRow_1.DocTableRow({ configuration }, [
|
|
302
|
+
MarkdownDocumenterHelpers_1.createTitleCell(apiMember, configuration, this._addFileNameSuffix),
|
|
303
|
+
MarkdownDocumenterHelpers_1.createModifiersCell(apiMember, configuration),
|
|
304
|
+
this._createPropertyTypeCell(apiMember),
|
|
305
|
+
MarkdownDocumenterHelpers_1.createDescriptionCell(apiMember, configuration)
|
|
306
|
+
]));
|
|
307
|
+
propertiesDefinitions.push(...this._createCompleteOutputForApiItem(apiMember));
|
|
308
|
+
}
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
if (eventsTable.rows.length > 0) {
|
|
314
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: 'Events' }));
|
|
315
|
+
output.push(eventsTable);
|
|
316
|
+
}
|
|
317
|
+
if (constructorsTable.rows.length > 0) {
|
|
318
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: 'Constructors' }));
|
|
319
|
+
output.push(constructorsTable);
|
|
320
|
+
}
|
|
321
|
+
if (propertiesTable.rows.length > 0) {
|
|
322
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: 'Properties' }));
|
|
323
|
+
output.push(propertiesTable);
|
|
324
|
+
}
|
|
325
|
+
if (methodsTable.rows.length > 0) {
|
|
326
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: 'Methods' }));
|
|
327
|
+
output.push(methodsTable);
|
|
328
|
+
}
|
|
329
|
+
output.push(...eventsDefinitions);
|
|
330
|
+
output.push(...constructorsDefinitions);
|
|
331
|
+
output.push(...propertiesDefinitions);
|
|
332
|
+
output.push(...methodsDefinitions);
|
|
333
|
+
return output;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* GENERATE PAGE: INTERFACE
|
|
337
|
+
*/
|
|
338
|
+
_createInterfaceTables(apiClass) {
|
|
339
|
+
const configuration = this._tsdocConfiguration;
|
|
340
|
+
const output = [];
|
|
341
|
+
const eventsTable = new DocTable_1.DocTable({
|
|
342
|
+
configuration,
|
|
343
|
+
headerTitles: ['Property', 'Type', 'Description']
|
|
344
|
+
});
|
|
345
|
+
const propertiesTable = new DocTable_1.DocTable({
|
|
346
|
+
configuration,
|
|
347
|
+
headerTitles: ['Property', 'Type', 'Description']
|
|
348
|
+
});
|
|
349
|
+
const methodsTable = new DocTable_1.DocTable({
|
|
350
|
+
configuration,
|
|
351
|
+
headerTitles: ['Method', 'Description']
|
|
352
|
+
});
|
|
353
|
+
const methodsDefinitions = [];
|
|
354
|
+
const propertiesDefinitions = [];
|
|
355
|
+
const eventsDefinitions = [];
|
|
356
|
+
for (const apiMember of apiClass.members) {
|
|
357
|
+
switch (apiMember.kind) {
|
|
358
|
+
case "ConstructSignature" /* ConstructSignature */:
|
|
359
|
+
case "MethodSignature" /* MethodSignature */: {
|
|
360
|
+
methodsTable.addRow(new DocTableRow_1.DocTableRow({ configuration }, [
|
|
361
|
+
MarkdownDocumenterHelpers_1.createTitleCell(apiMember, configuration, this._addFileNameSuffix),
|
|
362
|
+
MarkdownDocumenterHelpers_1.createDescriptionCell(apiMember, configuration)
|
|
363
|
+
]));
|
|
364
|
+
methodsDefinitions.push(...this._createCompleteOutputForApiItem(apiMember));
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
case "PropertySignature" /* PropertySignature */: {
|
|
368
|
+
if (apiMember.isEventProperty) {
|
|
369
|
+
eventsTable.addRow(new DocTableRow_1.DocTableRow({ configuration }, [
|
|
370
|
+
MarkdownDocumenterHelpers_1.createTitleCell(apiMember, configuration, this._addFileNameSuffix),
|
|
371
|
+
this._createPropertyTypeCell(apiMember),
|
|
372
|
+
MarkdownDocumenterHelpers_1.createDescriptionCell(apiMember, configuration)
|
|
373
|
+
]));
|
|
374
|
+
eventsDefinitions.push(...this._createCompleteOutputForApiItem(apiMember));
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
propertiesTable.addRow(new DocTableRow_1.DocTableRow({ configuration }, [
|
|
378
|
+
MarkdownDocumenterHelpers_1.createTitleCell(apiMember, configuration, this._addFileNameSuffix),
|
|
379
|
+
this._createPropertyTypeCell(apiMember),
|
|
380
|
+
MarkdownDocumenterHelpers_1.createDescriptionCell(apiMember, configuration)
|
|
381
|
+
]));
|
|
382
|
+
propertiesDefinitions.push(...this._createCompleteOutputForApiItem(apiMember));
|
|
383
|
+
}
|
|
384
|
+
break;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
if (eventsTable.rows.length > 0) {
|
|
389
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: 'Events' }));
|
|
390
|
+
output.push(eventsTable);
|
|
391
|
+
}
|
|
392
|
+
if (propertiesTable.rows.length > 0) {
|
|
393
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: 'Properties' }));
|
|
394
|
+
output.push(propertiesTable);
|
|
395
|
+
}
|
|
396
|
+
if (methodsTable.rows.length > 0) {
|
|
397
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: 'Methods' }));
|
|
398
|
+
output.push(methodsTable);
|
|
399
|
+
}
|
|
400
|
+
output.push(...eventsDefinitions);
|
|
401
|
+
output.push(...propertiesDefinitions);
|
|
402
|
+
output.push(...methodsDefinitions);
|
|
403
|
+
return output;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* GENERATE PAGE: FUNCTION-LIKE
|
|
407
|
+
*/
|
|
408
|
+
_createParameterTables(apiParameterListMixin) {
|
|
409
|
+
const configuration = this._tsdocConfiguration;
|
|
410
|
+
const output = [];
|
|
411
|
+
const parametersTable = new DocTable_1.DocTable({
|
|
412
|
+
configuration,
|
|
413
|
+
headerTitles: ['Parameter', 'Type', 'Description']
|
|
414
|
+
});
|
|
415
|
+
for (const apiParameter of apiParameterListMixin.parameters) {
|
|
416
|
+
const parameterDescription = new tsdoc_1.DocSection({
|
|
417
|
+
configuration
|
|
418
|
+
});
|
|
419
|
+
if (apiParameter.tsdocParamBlock) {
|
|
420
|
+
parameterDescription.appendNodes(apiParameter.tsdocParamBlock.content.nodes);
|
|
421
|
+
}
|
|
422
|
+
parametersTable.addRow(new DocTableRow_1.DocTableRow({ configuration }, [
|
|
423
|
+
new DocTableCell_1.DocTableCell({ configuration }, [
|
|
424
|
+
new tsdoc_1.DocParagraph({ configuration }, [
|
|
425
|
+
new tsdoc_1.DocPlainText({ configuration, text: apiParameter.name })
|
|
426
|
+
])
|
|
427
|
+
]),
|
|
428
|
+
new DocTableCell_1.DocTableCell({ configuration }, [
|
|
429
|
+
this._createParagraphForTypeExcerpt(apiParameter.parameterTypeExcerpt)
|
|
430
|
+
]),
|
|
431
|
+
new DocTableCell_1.DocTableCell({ configuration }, parameterDescription.nodes)
|
|
432
|
+
]));
|
|
433
|
+
}
|
|
434
|
+
if (parametersTable.rows.length > 0) {
|
|
435
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: 'Parameters', level: 2 }));
|
|
436
|
+
output.push(parametersTable);
|
|
437
|
+
}
|
|
438
|
+
if (api_extractor_model_me_1.ApiReturnTypeMixin.isBaseClassOf(apiParameterListMixin)) {
|
|
439
|
+
const returnTypeExcerpt = apiParameterListMixin.returnTypeExcerpt;
|
|
440
|
+
output.push(new tsdoc_1.DocParagraph({ configuration }, [
|
|
441
|
+
new DocEmphasisSpan_1.DocEmphasisSpan({ configuration, bold: true }, [
|
|
442
|
+
new tsdoc_1.DocPlainText({ configuration, text: 'Returns:' })
|
|
443
|
+
])
|
|
444
|
+
]));
|
|
445
|
+
output.push(this._createParagraphForTypeExcerpt(returnTypeExcerpt));
|
|
446
|
+
if (apiParameterListMixin instanceof api_extractor_model_me_1.ApiDocumentedItem) {
|
|
447
|
+
if (apiParameterListMixin.tsdocComment &&
|
|
448
|
+
apiParameterListMixin.tsdocComment.returnsBlock) {
|
|
449
|
+
output.push(...apiParameterListMixin.tsdocComment.returnsBlock.content.nodes);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
return output;
|
|
454
|
+
}
|
|
455
|
+
_createParagraphForTypeExcerpt(excerpt) {
|
|
456
|
+
const configuration = this._tsdocConfiguration;
|
|
457
|
+
const paragraph = new tsdoc_1.DocParagraph({ configuration });
|
|
458
|
+
if (!excerpt.text.trim()) {
|
|
459
|
+
paragraph.appendNode(new tsdoc_1.DocPlainText({ configuration, text: '(not declared)' }));
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
this._appendExcerptWithHyperlinks(paragraph, excerpt);
|
|
463
|
+
}
|
|
464
|
+
return paragraph;
|
|
465
|
+
}
|
|
466
|
+
_appendExcerptWithHyperlinks(docNodeContainer, excerpt) {
|
|
467
|
+
const configuration = this._tsdocConfiguration;
|
|
468
|
+
for (const token of excerpt.spannedTokens) {
|
|
469
|
+
// Markdown doesn't provide a standardized syntax for hyperlinks inside code spans, so we will render
|
|
470
|
+
// the type expression as DocPlainText. Instead of creating multiple DocParagraphs, we can simply
|
|
471
|
+
// discard any newlines and let the renderer do normal word-wrapping.
|
|
472
|
+
const unwrappedTokenText = token.text.replace(/[\r\n]+/g, ' ');
|
|
473
|
+
// If it's hyperlinkable, then append a DocLinkTag
|
|
474
|
+
if (token.kind === "Reference" /* Reference */ &&
|
|
475
|
+
token.canonicalReference) {
|
|
476
|
+
const apiItemResult = this._apiModel.resolveDeclarationReference(token.canonicalReference, undefined);
|
|
477
|
+
if (apiItemResult.resolvedApiItem) {
|
|
478
|
+
docNodeContainer.appendNode(new tsdoc_1.DocLinkTag({
|
|
479
|
+
configuration,
|
|
480
|
+
tagName: '@link',
|
|
481
|
+
linkText: unwrappedTokenText,
|
|
482
|
+
urlDestination: MarkdownDocumenterHelpers_1.getLinkForApiItem(apiItemResult.resolvedApiItem, this._addFileNameSuffix)
|
|
483
|
+
}));
|
|
484
|
+
continue;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
// Otherwise append non-hyperlinked text
|
|
488
|
+
docNodeContainer.appendNode(new tsdoc_1.DocPlainText({ configuration, text: unwrappedTokenText }));
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* GENERATE PAGE: MODEL
|
|
493
|
+
*/
|
|
494
|
+
_createModelTable(apiModel) {
|
|
495
|
+
const configuration = this._tsdocConfiguration;
|
|
496
|
+
const output = [];
|
|
497
|
+
const packagesTable = new DocTable_1.DocTable({
|
|
498
|
+
configuration,
|
|
499
|
+
headerTitles: ['Package', 'Description']
|
|
500
|
+
});
|
|
501
|
+
for (const apiMember of apiModel.members) {
|
|
502
|
+
const row = new DocTableRow_1.DocTableRow({ configuration }, [
|
|
503
|
+
MarkdownDocumenterHelpers_1.createTitleCell(apiMember, configuration, this._addFileNameSuffix),
|
|
504
|
+
MarkdownDocumenterHelpers_1.createDescriptionCell(apiMember, configuration)
|
|
505
|
+
]);
|
|
506
|
+
switch (apiMember.kind) {
|
|
507
|
+
case "Package" /* Package */:
|
|
508
|
+
packagesTable.addRow(row);
|
|
509
|
+
this._writeApiItemPage(apiMember);
|
|
510
|
+
break;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
if (packagesTable.rows.length > 0) {
|
|
514
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: 'Packages' }));
|
|
515
|
+
output.push(packagesTable);
|
|
516
|
+
}
|
|
517
|
+
return output;
|
|
518
|
+
}
|
|
519
|
+
/**´
|
|
520
|
+
* Generate a table of entry points if there are more than one entry points.
|
|
521
|
+
* Otherwise, generate the entry point directly in the package page.
|
|
522
|
+
*/
|
|
523
|
+
_createPackage(apiContainer) {
|
|
524
|
+
const configuration = this._tsdocConfiguration;
|
|
525
|
+
const output = [];
|
|
526
|
+
// If a package has a single entry point, generate entry point page in the package page directly
|
|
527
|
+
if (apiContainer.entryPoints.length === 1) {
|
|
528
|
+
return this._createEntryPointOrNamespace(apiContainer.members[0]);
|
|
529
|
+
}
|
|
530
|
+
const entryPointsTable = new DocTable_1.DocTable({
|
|
531
|
+
configuration,
|
|
532
|
+
headerTitles: ['Entry Point', 'Description']
|
|
533
|
+
});
|
|
534
|
+
for (const entryPoint of apiContainer.entryPoints) {
|
|
535
|
+
const row = new DocTableRow_1.DocTableRow({ configuration }, [
|
|
536
|
+
MarkdownDocumenterHelpers_1.createEntryPointTitleCell(entryPoint, configuration, this._addFileNameSuffix),
|
|
537
|
+
MarkdownDocumenterHelpers_1.createDescriptionCell(entryPoint, configuration)
|
|
538
|
+
]);
|
|
539
|
+
entryPointsTable.addRow(row);
|
|
540
|
+
}
|
|
541
|
+
output.push(entryPointsTable);
|
|
542
|
+
// write entry point pages
|
|
543
|
+
for (const entryPoint of apiContainer.entryPoints) {
|
|
544
|
+
this._writeApiItemPage(entryPoint);
|
|
545
|
+
}
|
|
546
|
+
return output;
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* GENERATE PAGE: ENTRYPOINT or NAMESPACE
|
|
550
|
+
*/
|
|
551
|
+
_createEntryPointOrNamespace(apiContainer) {
|
|
552
|
+
const configuration = this._tsdocConfiguration;
|
|
553
|
+
const output = [];
|
|
554
|
+
const classesTable = new DocTable_1.DocTable({
|
|
555
|
+
configuration,
|
|
556
|
+
headerTitles: ['Class', 'Description']
|
|
557
|
+
});
|
|
558
|
+
const enumerationsTable = new DocTable_1.DocTable({
|
|
559
|
+
configuration,
|
|
560
|
+
headerTitles: ['Enumeration', 'Description']
|
|
561
|
+
});
|
|
562
|
+
const functionsTable = new DocTable_1.DocTable({
|
|
563
|
+
configuration,
|
|
564
|
+
headerTitles: ['Function', 'Description']
|
|
565
|
+
});
|
|
566
|
+
const interfacesTable = new DocTable_1.DocTable({
|
|
567
|
+
configuration,
|
|
568
|
+
headerTitles: ['Interface', 'Description']
|
|
569
|
+
});
|
|
570
|
+
const namespacesTable = new DocTable_1.DocTable({
|
|
571
|
+
configuration,
|
|
572
|
+
headerTitles: ['Namespace', 'Description']
|
|
573
|
+
});
|
|
574
|
+
const variablesTable = new DocTable_1.DocTable({
|
|
575
|
+
configuration,
|
|
576
|
+
headerTitles: ['Variable', 'Description']
|
|
577
|
+
});
|
|
578
|
+
const typeAliasesTable = new DocTable_1.DocTable({
|
|
579
|
+
configuration,
|
|
580
|
+
headerTitles: ['Type Alias', 'Description']
|
|
581
|
+
});
|
|
582
|
+
const functionsDefinitions = [];
|
|
583
|
+
const variablesDefinitions = [];
|
|
584
|
+
const typeAliasDefinitions = [];
|
|
585
|
+
const enumsDefinitions = [];
|
|
586
|
+
const apiMembers = apiContainer.kind === "EntryPoint" /* EntryPoint */
|
|
587
|
+
? apiContainer.members
|
|
588
|
+
: apiContainer.members;
|
|
589
|
+
for (const apiMember of apiMembers) {
|
|
590
|
+
const row = new DocTableRow_1.DocTableRow({ configuration }, [
|
|
591
|
+
MarkdownDocumenterHelpers_1.createTitleCell(apiMember, configuration, this._addFileNameSuffix),
|
|
592
|
+
MarkdownDocumenterHelpers_1.createDescriptionCell(apiMember, configuration)
|
|
593
|
+
]);
|
|
594
|
+
switch (apiMember.kind) {
|
|
595
|
+
case "Class" /* Class */:
|
|
596
|
+
classesTable.addRow(row);
|
|
597
|
+
this._writeApiItemPage(apiMember);
|
|
598
|
+
break;
|
|
599
|
+
case "Enum" /* Enum */:
|
|
600
|
+
enumerationsTable.addRow(row);
|
|
601
|
+
enumsDefinitions.push(...this._createCompleteOutputForApiItem(apiMember));
|
|
602
|
+
break;
|
|
603
|
+
case "Interface" /* Interface */:
|
|
604
|
+
interfacesTable.addRow(row);
|
|
605
|
+
this._writeApiItemPage(apiMember);
|
|
606
|
+
break;
|
|
607
|
+
case "Namespace" /* Namespace */:
|
|
608
|
+
namespacesTable.addRow(row);
|
|
609
|
+
this._writeApiItemPage(apiMember);
|
|
610
|
+
break;
|
|
611
|
+
case "Function" /* Function */:
|
|
612
|
+
functionsTable.addRow(row);
|
|
613
|
+
functionsDefinitions.push(...this._createCompleteOutputForApiItem(apiMember));
|
|
614
|
+
break;
|
|
615
|
+
case "TypeAlias" /* TypeAlias */:
|
|
616
|
+
typeAliasesTable.addRow(row);
|
|
617
|
+
typeAliasDefinitions.push(...this._createCompleteOutputForApiItem(apiMember));
|
|
618
|
+
break;
|
|
619
|
+
case "Variable" /* Variable */:
|
|
620
|
+
variablesTable.addRow(row);
|
|
621
|
+
variablesDefinitions.push(...this._createCompleteOutputForApiItem(apiMember));
|
|
622
|
+
break;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
if (functionsTable.rows.length > 0) {
|
|
626
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: 'Functions' }));
|
|
627
|
+
output.push(functionsTable);
|
|
628
|
+
}
|
|
629
|
+
if (classesTable.rows.length > 0) {
|
|
630
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: 'Classes' }));
|
|
631
|
+
output.push(classesTable);
|
|
632
|
+
}
|
|
633
|
+
if (enumerationsTable.rows.length > 0) {
|
|
634
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: 'Enumerations' }));
|
|
635
|
+
output.push(enumerationsTable);
|
|
636
|
+
}
|
|
637
|
+
if (interfacesTable.rows.length > 0) {
|
|
638
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: 'Interfaces' }));
|
|
639
|
+
output.push(interfacesTable);
|
|
640
|
+
}
|
|
641
|
+
if (namespacesTable.rows.length > 0) {
|
|
642
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: 'Namespaces' }));
|
|
643
|
+
output.push(namespacesTable);
|
|
644
|
+
}
|
|
645
|
+
if (variablesTable.rows.length > 0) {
|
|
646
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: 'Variables' }));
|
|
647
|
+
output.push(variablesTable);
|
|
648
|
+
}
|
|
649
|
+
if (typeAliasesTable.rows.length > 0) {
|
|
650
|
+
output.push(new DocHeading_1.DocHeading({ configuration, title: 'Type Aliases' }));
|
|
651
|
+
output.push(typeAliasesTable);
|
|
652
|
+
}
|
|
653
|
+
if (functionsDefinitions.length > 0) {
|
|
654
|
+
output.push(...functionsDefinitions);
|
|
655
|
+
}
|
|
656
|
+
if (variablesDefinitions.length > 0) {
|
|
657
|
+
output.push(...variablesDefinitions);
|
|
658
|
+
}
|
|
659
|
+
if (typeAliasDefinitions.length > 0) {
|
|
660
|
+
output.push(...typeAliasDefinitions);
|
|
661
|
+
}
|
|
662
|
+
if (enumsDefinitions.length > 0) {
|
|
663
|
+
output.push(...enumsDefinitions);
|
|
664
|
+
}
|
|
665
|
+
return output;
|
|
666
|
+
}
|
|
667
|
+
_createPropertyTypeCell(apiItem) {
|
|
668
|
+
const section = new tsdoc_1.DocSection({
|
|
669
|
+
configuration: this._tsdocConfiguration
|
|
670
|
+
});
|
|
671
|
+
if (apiItem instanceof api_extractor_model_me_1.ApiPropertyItem) {
|
|
672
|
+
section.appendNode(this._createParagraphForTypeExcerpt(apiItem.propertyTypeExcerpt));
|
|
673
|
+
}
|
|
674
|
+
return new DocTableCell_1.DocTableCell({ configuration: this._tsdocConfiguration }, section.nodes);
|
|
675
|
+
}
|
|
676
|
+
_createSignatureSection(apiItem) {
|
|
677
|
+
const configuration = this._tsdocConfiguration;
|
|
678
|
+
const nodes = [];
|
|
679
|
+
if (apiItem.excerpt.text.length > 0) {
|
|
680
|
+
nodes.push(new tsdoc_1.DocParagraph({ configuration }, [
|
|
681
|
+
new DocEmphasisSpan_1.DocEmphasisSpan({ configuration, bold: true }, [
|
|
682
|
+
new tsdoc_1.DocPlainText({ configuration, text: 'Signature:' })
|
|
683
|
+
])
|
|
684
|
+
]));
|
|
685
|
+
nodes.push(new tsdoc_1.DocFencedCode({
|
|
686
|
+
configuration,
|
|
687
|
+
code: apiItem.getExcerptWithModifiers(),
|
|
688
|
+
language: 'typescript'
|
|
689
|
+
}));
|
|
690
|
+
}
|
|
691
|
+
nodes.push(...this._writeHeritageTypes(apiItem));
|
|
692
|
+
return nodes;
|
|
693
|
+
}
|
|
694
|
+
_writeHeritageTypes(apiItem) {
|
|
695
|
+
const configuration = this._tsdocConfiguration;
|
|
696
|
+
const nodes = [];
|
|
697
|
+
if (apiItem instanceof api_extractor_model_me_1.ApiClass) {
|
|
698
|
+
if (apiItem.extendsType) {
|
|
699
|
+
const extendsParagraph = new tsdoc_1.DocParagraph({ configuration }, [
|
|
700
|
+
new DocEmphasisSpan_1.DocEmphasisSpan({ configuration, bold: true }, [
|
|
701
|
+
new tsdoc_1.DocPlainText({ configuration, text: 'Extends: ' })
|
|
702
|
+
])
|
|
703
|
+
]);
|
|
704
|
+
this._appendExcerptWithHyperlinks(extendsParagraph, apiItem.extendsType.excerpt);
|
|
705
|
+
nodes.push(extendsParagraph);
|
|
706
|
+
}
|
|
707
|
+
if (apiItem.implementsTypes.length > 0) {
|
|
708
|
+
const implementsParagraph = new tsdoc_1.DocParagraph({ configuration }, [
|
|
709
|
+
new DocEmphasisSpan_1.DocEmphasisSpan({ configuration, bold: true }, [
|
|
710
|
+
new tsdoc_1.DocPlainText({ configuration, text: 'Implements: ' })
|
|
711
|
+
])
|
|
712
|
+
]);
|
|
713
|
+
let needsComma = false;
|
|
714
|
+
for (const implementsType of apiItem.implementsTypes) {
|
|
715
|
+
if (needsComma) {
|
|
716
|
+
implementsParagraph.appendNode(new tsdoc_1.DocPlainText({ configuration, text: ', ' }));
|
|
717
|
+
}
|
|
718
|
+
this._appendExcerptWithHyperlinks(implementsParagraph, implementsType.excerpt);
|
|
719
|
+
needsComma = true;
|
|
720
|
+
}
|
|
721
|
+
nodes.push(implementsParagraph);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
if (apiItem instanceof api_extractor_model_me_1.ApiInterface) {
|
|
725
|
+
if (apiItem.extendsTypes.length > 0) {
|
|
726
|
+
const extendsParagraph = new tsdoc_1.DocParagraph({ configuration }, [
|
|
727
|
+
new DocEmphasisSpan_1.DocEmphasisSpan({ configuration, bold: true }, [
|
|
728
|
+
new tsdoc_1.DocPlainText({ configuration, text: 'Extends: ' })
|
|
729
|
+
])
|
|
730
|
+
]);
|
|
731
|
+
let needsComma = false;
|
|
732
|
+
for (const extendsType of apiItem.extendsTypes) {
|
|
733
|
+
if (needsComma) {
|
|
734
|
+
extendsParagraph.appendNode(new tsdoc_1.DocPlainText({ configuration, text: ', ' }));
|
|
735
|
+
}
|
|
736
|
+
this._appendExcerptWithHyperlinks(extendsParagraph, extendsType.excerpt);
|
|
737
|
+
needsComma = true;
|
|
738
|
+
}
|
|
739
|
+
nodes.push(extendsParagraph);
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
return nodes;
|
|
743
|
+
}
|
|
744
|
+
_deleteOldOutputFiles() {
|
|
745
|
+
console.log('Deleting old output from ' + this._outputFolder);
|
|
746
|
+
node_core_library_1.FileSystem.ensureEmptyFolder(this._outputFolder);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
exports.MarkdownDocumenter = MarkdownDocumenter;
|
|
750
|
+
//# sourceMappingURL=MarkdownDocumenter.js.map
|