Module @knodes/typedoc-plugin-pages

@knodes/typedoc-plugin-pages

A TypeDoc plugin that lets you integrate your own pages into the documentation output

npm version npm downloads Compatible with TypeDoc


CircleCI Code Climate coverage Code Climate maintainability

For more infos, please refer to the documentation

Features

  • 🔍 Search integration
  • 🔗 Interpage hyperlinks
  • 🎨 Compatible with default & custom themes
  • 📁 Monorepo support
  • 🎯 Locate invalid markups
  • 🔅 Glob support

Usage

  1. Create markdown files into your repository (by default in the pages directory).

  2. Configure your pages tree in the typedoc configuration. Example:

    {
    "pluginPages": {
    "pages": [ { "name": "My project name", "moduleRoot": true, "children": [
    { "name": "Some cool docs", "source": "cool-docs.md" },
    { "name": "Configuration", "childrenDir": "configuration", "children": [
    { "name": "Configuration file", "source": "file.md" },
    { "name": "CLI options", "source": "cli.md" },
    ] },
    ] } ]
    }
    }

    See the pages tree guide, or the options documentation page for more infos.

  3. In any markdown content (in README, pages, or doc comments), use the {@page ...} tag to create a link to a page.

Syntax:

{@page <path-to-file>[ link label]}
  • <path-to-file>: A path to the desired page. Checkout this documentation page for more infos on the syntax of the path.
  • [ link label]: allow to specify the text in the link. If not set, the target page name is used.

Quick start

npm install --save-dev @knodes/typedoc-plugin-pages typedoc@^0.23.0

Compatibility

This plugin version should match TypeDoc ^0.23.0 for compatibility.

Note: this plugin version was released by testing against ^0.23.28.

NOTE: This plugin is based on typedoc-plugin-loopingz-pages, which is in turn a fork of typedoc-plugin-pages. Integrating it in this monorepo should (I hope) make easier maintenance.


Example configuration

Here is a sample of this monorepo configuration:

From ./typedoc.config.js#4~67

module.exports = {
// ...
name: 'Knodes TypeDoc Plugins',
entryPoints: [
'packages/*',
],
entryPointStrategy: 'packages',
/** @type {import('@knodes/typedoc-plugin-pages').IPluginOptions} */
pluginPages: {
pages: [
// Add `pages/readme-extras.md` at the end of the module's readme in every module containing it. Use function template.
{ loader: 'template', match: 'pages/readme-extras.md', template: context => [
{ moduleRoot: true, name: `@knodes/typedoc-${basename( context.from )}`, source: context.match },
] },
// Add `pages/options.md` page in every module containing it. Use JSON-compatible template.
{ loader: 'template', match: 'pages/options.md', template: [
{ moduleRoot: true, name: '@knodes/typedoc-${path.basename(match.from)}', children: [
{ name: 'Using options', source: '${match.match}' },
] },
] },
// ...
{ loader: 'template', match: 'CHANGELOG.md', template: context => [
{ moduleRoot: true, name: context.module.name, children: [
{ name: 'Changelog', source: context.match },
] },
] },
],
// ...
},
// ...
};

See Using options for a detailed list of options, and Managing pages & menu items to read more about why the pluginPages.pages option is structured like this.

Index

Namespaces

Enumerations

Classes

Interfaces

Type Aliases

Functions

Generated using TypeDoc