@microsoft/api-documenter

  • Version 7.19.14
  • Published
  • 607 kB
  • 7 dependencies
  • MIT license

Install

npm i @microsoft/api-documenter
yarn add @microsoft/api-documenter
pnpm add @microsoft/api-documenter

Overview

API Documenter generates an API reference website from the .api.json files created by API Extractor. The @microsoft/api-documenter package provides the command-line tool. It also exposes a developer API that you can use to create plugins that customize how API Documenter generates documentation.

Index

Classes

class MarkdownDocumenterAccessor

class MarkdownDocumenterAccessor {}
  • Provides access to the documenter that is generating the output.

    Modifiers

    • @public

method getLinkForApiItem

getLinkForApiItem: (apiItem: ApiItem) => string | undefined;
  • For a given ApiItem, return its markdown hyperlink.

    Returns

    The hyperlink, or undefined if the ApiItem object does not have a hyperlink.

class MarkdownDocumenterFeature

class MarkdownDocumenterFeature extends PluginFeature {}
  • Inherit from this base class to implement an API Documenter plugin feature that customizes the generation of markdown output.

    Modifiers

    • @public

property context

context: MarkdownDocumenterFeatureContext;

method [Symbol.hasInstance]

static [Symbol.hasInstance]: (instance: object) => boolean;

    method onBeforeWritePage

    onBeforeWritePage: (
    eventArgs: IMarkdownDocumenterFeatureOnBeforeWritePageArgs
    ) => void;
    • This event occurs before each markdown file is written. It provides an opportunity to customize the content of the file.

      Modifiers

      • @virtual

    method onFinished

    onFinished: (eventArgs: IMarkdownDocumenterFeatureOnFinishedArgs) => void;
    • This event occurs after all output files have been written.

      Modifiers

      • @virtual

    class MarkdownDocumenterFeatureContext

    class MarkdownDocumenterFeatureContext {}

    property apiModel

    readonly apiModel: ApiModel;
    • Provides access to the ApiModel for the documentation being generated.

    property documenter

    readonly documenter: MarkdownDocumenterAccessor;
    • Exposes functionality of the documenter.

    property outputFolder

    readonly outputFolder: string;
    • The full path to the output folder.

    class PluginFeature

    abstract class PluginFeature {}
    • The abstract base class for all API Documenter plugin features.

      Modifiers

      • @public

    property context

    context: PluginFeatureContext;
    • Exposes various services that can be used by a plugin.

    method [Symbol.hasInstance]

    static [Symbol.hasInstance]: (instance: object) => boolean;

      method onInitialized

      onInitialized: () => void;
      • This event function is called after the feature is initialized, but before any processing occurs.

        Modifiers

        • @virtual

      class PluginFeatureContext

      class PluginFeatureContext {}
      • Context object for PluginFeature. Exposes various services that can be used by a plugin.

        Modifiers

        • @public

      class PluginFeatureInitialization

      class PluginFeatureInitialization {}
      • This is an internal part of the plugin infrastructure.

        Remarks

        This object is the constructor parameter for API Documenter plugin features.

        Modifiers

        • @public

      Interfaces

      interface IApiDocumenterPluginManifest

      interface IApiDocumenterPluginManifest {}
      • The manifest for an API Documenter plugin.

        Remarks

        An API documenter plugin is an NPM package. By convention, the NPM package name should have the prefix doc-plugin-. Its main entry point should export an object named apiDocumenterPluginManifest which implements the IApiDocumenterPluginManifest interface.

        For example:

        class MyMarkdownDocumenter extends MarkdownDocumenterFeature {
        public onInitialized(): void {
        console.log('MyMarkdownDocumenter: onInitialized()');
        }
        }
        export const apiDocumenterPluginManifest: IApiDocumenterPluginManifest = {
        manifestVersion: 1000,
        features: [
        {
        featureName: 'my-markdown-documenter',
        kind: 'MarkdownDocumenterFeature',
        subclass: MyMarkdownDocumenter
        }
        ]
        };

        Modifiers

        • @public

      property features

      features: IFeatureDefinition[];
      • The list of features provided by this plugin.

      property manifestVersion

      manifestVersion: 1000;
      • The manifest version number. For now, this must always be 1000.

      interface IFeatureDefinition

      interface IFeatureDefinition {}
      • Defines a "feature" that is provided by an API Documenter plugin. A feature is a user-defined module that customizes the behavior of API Documenter.

        Modifiers

        • @public

      property featureName

      featureName: string;
      • The name of this feature, as it will appear in the config file.

        The name should consist of one or more words separated by hyphens. Each word should consist of lower case letters and numbers. Example: my-feature

      property kind

      kind: 'MarkdownDocumenterFeature';
      • Determines the kind of feature. The specified value is the name of the base class that subclass inherits from.

        Remarks

        For now, MarkdownDocumenterFeature is the only supported value.

      property subclass

      subclass: {
      new (initialization: PluginFeatureInitialization): MarkdownDocumenterFeature;
      };
      • Your subclass that extends from the base class.

      interface IMarkdownDocumenterFeatureOnBeforeWritePageArgs

      interface IMarkdownDocumenterFeatureOnBeforeWritePageArgs {}
      • Event arguments for MarkdownDocumenterFeature.onBeforeWritePage()

        Modifiers

        • @public

      property apiItem

      readonly apiItem: ApiItem;
      • The API item corresponding to this page.

      property outputFilename

      readonly outputFilename: string;
      • The filename where the output will be written.

      property pageContent

      pageContent: string;

      interface IMarkdownDocumenterFeatureOnFinishedArgs

      interface IMarkdownDocumenterFeatureOnFinishedArgs {}
      • Event arguments for MarkdownDocumenterFeature.onFinished()

        Modifiers

        • @public

      Package Files (1)

      Dependencies (7)

      Dev Dependencies (7)

      Peer Dependencies (0)

      No peer dependencies.

      Badge

      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@microsoft/api-documenter.

      • Markdown
        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@microsoft/api-documenter)
      • HTML
        <a href="https://www.jsdocs.io/package/@microsoft/api-documenter"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>