Table of contents

Change how the table of contents is generated

You can Override the default table of contents plugin by passing an alternative plugin in options.ts.

export type Options = {
  // other options
  tocPlugin?: (headings: DocHeading[]) => unified.Plugin;
};

The array that is passed to the plugin should be filled with the headings that are retrieving when parsing the AST.

export type DocServiceOptions = ConfigOptions & {
  // other options
  tocPlugin?: (headings: DocHeading[]) => unified.Plugin;
};