File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ import { IConfigFile } from '../documenters/IConfigFile';
1111
1212import { ApiModel } from '@microsoft/api-extractor-model' ;
1313import { FileSystem } from '@microsoft/node-core-library' ;
14+ import { MarkdownDocumenter } from '../documenters/MarkdownDocumenter' ;
15+ import { PluginContext } from '../plugin/PluginContext' ;
1416
1517export class GenerateAction extends BaseAction {
1618 constructor ( parser : ApiDocumenterCommandLine ) {
@@ -38,10 +40,19 @@ export class GenerateAction extends BaseAction {
3840
3941 const configFile : IConfigFile = DocumenterConfig . loadFile ( configFilePath ) ;
4042
43+ const pluginContext : PluginContext = new PluginContext ( ) ;
44+ pluginContext . load ( configFile . plugins || [ ] , configFilePath ) ;
45+
4146 const apiModel : ApiModel = this . buildApiModel ( ) ;
4247
43- const yamlDocumenter : ExperimentalYamlDocumenter = new ExperimentalYamlDocumenter ( apiModel , configFile ) ;
44- yamlDocumenter . generateFiles ( this . outputFolder ) ;
48+ if ( configFile . outputTarget === 'docfx' ) {
49+ const yamlDocumenter : ExperimentalYamlDocumenter = new ExperimentalYamlDocumenter ( apiModel , configFile ) ;
50+ yamlDocumenter . generateFiles ( this . outputFolder ) ;
51+ } else {
52+ const markdownDocumenter : MarkdownDocumenter = new MarkdownDocumenter ( apiModel ) ;
53+ markdownDocumenter . generateFiles ( this . outputFolder ) ;
54+ }
55+
4556 return Promise . resolve ( ) ;
4657 }
4758}
Original file line number Diff line number Diff line change @@ -50,10 +50,36 @@ export interface IConfigTableOfContents {
5050 nonEmptyCategoryNodeNames ?: string [ ] ;
5151}
5252
53+ /**
54+ * Describes plugin packages to be loaded, and which features to enable.
55+ */
56+ export interface IConfigPlugin {
57+ /**
58+ * Specifies the name of an API Documenter plugin package to be loaded. By convention, the NPM package name
59+ * should have the prefix `doc-plugin-`. Its main entry point should export an object named
60+ * `apiDocumenterPluginManifest` which implements the {@link IApiDocumenterPluginManifest} interface.
61+ */
62+ packageName : string ;
63+
64+ /**
65+ * A list of features to be enabled. The features are defined in {@link IApiDocumenterPluginManifest.features}.
66+ * The `enabledFeatureNames` strings are matched with {@link IFeatureDefinition.featureName}.
67+ */
68+ enabledFeatureNames : string [ ] ;
69+ }
70+
5371/**
5472 * This interface represents the api-extractor.json file format.
5573 */
5674export interface IConfigFile {
75+ /**
76+ * Specifies the output target.
77+ */
78+ outputTarget : 'docfx' | 'markdown' ;
79+
80+ /** {@inheritDoc IConfigPlugin } */
81+ plugins ?: IConfigPlugin [ ] ;
82+
5783 /** {@inheritDoc IConfigTableOfContents } */
5884 tableOfContents ?: IConfigTableOfContents ;
5985}
Original file line number Diff line number Diff line change 88 "type" : " string"
99 },
1010
11+ "outputTarget" : {
12+ "description" : " Specifies what type of documentation will be generated" ,
13+ "type" : " string" ,
14+ "enum" : [
15+ " docfx" ,
16+ " markdown"
17+ ]
18+ },
19+
20+ "plugins" : {
21+ "description" : " Specifies plugin packages to be loaded" ,
22+ "type" : " array"
23+ },
24+
1125 "tableOfContents" : {
1226 "description" : " Configures how the table of contents is generated." ,
1327 "type" : " object" ,
1428 "additionalProperties" : true
1529 },
1630 },
31+
1732 "additionalProperties" : false
1833}
You can’t perform that action at this time.
0 commit comments