@rspress/plugin-typedoc
Integration of TypeDoc's Rspress Plugin for Automatically Generating API Documentation for TS Modules.
Installation
Usage
When you start/build the project, the plugin will automatically generate an api directory in your document root directory. The directory structure is as follows:
This means that the plugin will internally call TypeDoc to automatically generate API documentation for your modules, including module lists, Interface details, function details (parameters, return values, description), etc.
Note that the .md documentation files are regenerated every time you start the project to reflect the latest module content. Therefore, we recommend adding the .md files in the api directory to .gitignore, for example docs/api/**/*.md. If you customize the output directory with the outDir parameter below, you should also add the corresponding .md files to .gitignore.
The _meta.json file is only automatically generated on the first run and will not be overwritten afterwards. This means you can manually edit it to customize the sidebar structure (e.g., add dividers, adjust order, etc.) and commit it to git.
We do not recommend modifying the generated .md documents in the api directory because these documents will be overwritten each time the project is started due to changes in module content.
Parameter description
entryPoints
- Type:
string[] - Default:
[]
Specifies the absolute path of the TS modules for which documentation should be generated.
outDir
- Type:
string - Default:
api
Customize the output directory for the documentation. You need to provide a relative path, such as api/custom.
setup
- Type:
(app: Application) => Promise<Application> | Promise<void> | void - Default:
() => {}
A function to setup the TypeDoc Application. You can use this to customize the TypeDoc configuration before it generates the documentation.