UNPKG

3.91 kBSource Map (JSON)View Raw
1{"version":3,"file":"MarkdownDocumenterFeature.js","sourceRoot":"","sources":["../../src/plugin/MarkdownDocumenterFeature.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAG3D,oEAAwD;AACxD,mDAAgD;AAGhD;;;;;GAKG;AACH,MAAa,gCAAgC;IAgB3C,gBAAgB;IAChB,YAAmB,OAAyC;QAC1D,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACvC,CAAC;CACF;AAtBD,4EAsBC;AA8BD,MAAM,6BAA6B,GAAW,sCAAsC,CAAC;AAErF;;;;;GAKG;AACH,MAAa,yBAA0B,SAAQ,6BAAa;IAI1D;;;;OAIG;IACI,iBAAiB,CAAC,SAA0D;QACjF,+BAA+B;IACjC,CAAC;IAED;;;OAGG;IACI,UAAU,CAAC,SAAmD;QACnE,+BAA+B;IACjC,CAAC;IAEM,MAAM,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,QAAgB;QACjD,OAAO,4BAAQ,CAAC,YAAY,CAAC,QAAQ,EAAE,6BAA6B,CAAC,CAAC;IACxE,CAAC;CACF;AAxBD,8DAwBC;AAED,4BAAQ,CAAC,aAAa,CAAC,yBAAyB,EAAE,6BAA6B,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { ApiItem, ApiModel } from '@microsoft/api-extractor-model';\nimport { TypeUuid } from '@rushstack/node-core-library';\nimport { PluginFeature } from './PluginFeature';\nimport { MarkdownDocumenterAccessor } from './MarkdownDocumenterAccessor';\n\n/**\n * Context object for {@link MarkdownDocumenterFeature}.\n * Exposes various services that can be used by a plugin.\n *\n * @public\n */\nexport class MarkdownDocumenterFeatureContext {\n /**\n * Provides access to the `ApiModel` for the documentation being generated.\n */\n public readonly apiModel: ApiModel;\n\n /**\n * The full path to the output folder.\n */\n public readonly outputFolder: string;\n\n /**\n * Exposes functionality of the documenter.\n */\n public readonly documenter: MarkdownDocumenterAccessor;\n\n /** @internal */\n public constructor(options: MarkdownDocumenterFeatureContext) {\n this.apiModel = options.apiModel;\n this.outputFolder = options.outputFolder;\n this.documenter = options.documenter;\n }\n}\n\n/**\n * Event arguments for MarkdownDocumenterFeature.onBeforeWritePage()\n * @public\n */\nexport interface IMarkdownDocumenterFeatureOnBeforeWritePageArgs {\n /**\n * The API item corresponding to this page.\n */\n readonly apiItem: ApiItem;\n\n /**\n * The page content. The {@link MarkdownDocumenterFeature.onBeforeWritePage} handler can reassign this\n * string to customize the page appearance.\n */\n pageContent: string;\n\n /**\n * The filename where the output will be written.\n */\n readonly outputFilename: string;\n}\n\n/**\n * Event arguments for MarkdownDocumenterFeature.onFinished()\n * @public\n */\nexport interface IMarkdownDocumenterFeatureOnFinishedArgs {}\n\nconst uuidMarkdownDocumenterFeature: string = '34196154-9eb3-4de0-a8c8-7e9539dfe216';\n\n/**\n * Inherit from this base class to implement an API Documenter plugin feature that customizes\n * the generation of markdown output.\n *\n * @public\n */\nexport class MarkdownDocumenterFeature extends PluginFeature {\n /** {@inheritdoc PluginFeature.context} */\n public context!: MarkdownDocumenterFeatureContext;\n\n /**\n * This event occurs before each markdown file is written. It provides an opportunity to customize the\n * content of the file.\n * @virtual\n */\n public onBeforeWritePage(eventArgs: IMarkdownDocumenterFeatureOnBeforeWritePageArgs): void {\n // (implemented by child class)\n }\n\n /**\n * This event occurs after all output files have been written.\n * @virtual\n */\n public onFinished(eventArgs: IMarkdownDocumenterFeatureOnFinishedArgs): void {\n // (implemented by child class)\n }\n\n public static [Symbol.hasInstance](instance: object): boolean {\n return TypeUuid.isInstanceOf(instance, uuidMarkdownDocumenterFeature);\n }\n}\n\nTypeUuid.registerClass(MarkdownDocumenterFeature, uuidMarkdownDocumenterFeature);\n"]}
\No newline at end of file