@@ -100,10 +100,7 @@ export class MarkdownDocumenter {
100100 console . log ( ) ;
101101 this . _deleteOldOutputFiles ( ) ;
102102
103- for ( const apiPackage of this . _apiModel . packages ) {
104- console . log ( `Writing ${ apiPackage . name } package` ) ;
105- this . _writeApiItemPage ( apiPackage ) ;
106- }
103+ this . _writeApiItemPage ( this . _apiModel ) ;
107104
108105 if ( this . _pluginLoader . markdownDocumenterFeature ) {
109106 this . _pluginLoader . markdownDocumenterFeature . onFinished ( { } ) ;
@@ -139,10 +136,14 @@ export class MarkdownDocumenter {
139136 case ApiItemKind . Function :
140137 output . appendNode ( new DocHeading ( { configuration, title : `${ scopedName } function` } ) ) ;
141138 break ;
139+ case ApiItemKind . Model :
140+ output . appendNode ( new DocHeading ( { configuration, title : `API Reference` } ) ) ;
141+ break ;
142142 case ApiItemKind . Namespace :
143143 output . appendNode ( new DocHeading ( { configuration, title : `${ scopedName } namespace` } ) ) ;
144144 break ;
145145 case ApiItemKind . Package :
146+ console . log ( `Writing ${ apiItem . displayName } package` ) ;
146147 const unscopedPackageName : string = PackageName . getUnscopedName ( apiItem . displayName ) ;
147148 output . appendNode ( new DocHeading ( { configuration, title : `${ unscopedPackageName } package` } ) ) ;
148149 break ;
@@ -226,6 +227,9 @@ export class MarkdownDocumenter {
226227 case ApiItemKind . Namespace :
227228 this . _writePackageOrNamespaceTables ( output , apiItem as ApiNamespace ) ;
228229 break ;
230+ case ApiItemKind . Model :
231+ this . _writeModelTable ( output , apiItem as ApiModel ) ;
232+ break ;
229233 case ApiItemKind . Package :
230234 this . _writePackageOrNamespaceTables ( output , apiItem as ApiPackage ) ;
231235 break ;
@@ -297,6 +301,37 @@ export class MarkdownDocumenter {
297301 } ) ;
298302 }
299303
304+ /**
305+ * GENERATE PAGE: MODEL
306+ */
307+ private _writeModelTable ( output : DocSection , apiModel : ApiModel ) : void {
308+ const configuration : TSDocConfiguration = this . _tsdocConfiguration ;
309+
310+ const packagesTable : DocTable = new DocTable ( { configuration,
311+ headerTitles : [ 'Package' , 'Description' ]
312+ } ) ;
313+
314+ for ( const apiMember of apiModel . members ) {
315+
316+ const row : DocTableRow = new DocTableRow ( { configuration } , [
317+ this . _createTitleCell ( apiMember ) ,
318+ this . _createDescriptionCell ( apiMember )
319+ ] ) ;
320+
321+ switch ( apiMember . kind ) {
322+ case ApiItemKind . Package :
323+ packagesTable . addRow ( row ) ;
324+ this . _writeApiItemPage ( apiMember ) ;
325+ break ;
326+ }
327+ }
328+
329+ if ( packagesTable . rows . length > 0 ) {
330+ output . appendNode ( new DocHeading ( { configuration : this . _tsdocConfiguration , title : 'Packages' } ) ) ;
331+ output . appendNode ( packagesTable ) ;
332+ }
333+ }
334+
300335 /**
301336 * GENERATE PAGE: PACKAGE or NAMESPACE
302337 */
@@ -767,7 +802,7 @@ export class MarkdownDocumenter {
767802 configuration : this . _tsdocConfiguration ,
768803 tagName : '@link' ,
769804 linkText : 'Home' ,
770- urlDestination : './index.md'
805+ urlDestination : this . _getLinkFilenameForApiItem ( this . _apiModel )
771806 } ) ) ;
772807
773808 for ( const hierarchyItem of apiItem . getHierarchy ( ) ) {
@@ -831,6 +866,10 @@ export class MarkdownDocumenter {
831866 }
832867
833868 private _getFilenameForApiItem ( apiItem : ApiItem ) : string {
869+ if ( apiItem . kind === ApiItemKind . Model ) {
870+ return 'index.md' ;
871+ }
872+
834873 let baseName : string = '' ;
835874 for ( const hierarchyItem of apiItem . getHierarchy ( ) ) {
836875 // For overloaded methods, add a suffix such as "MyClass.myMethod_2".
0 commit comments