This is a plugin for TypeDoc that merges the content of modules.
Use cases:
- If you want to document an entire application and not a library, you can specify all files that you want to have documented as entry points for TypeDoc and use this plugin to merge all modules into the project root removing the extra module layer.
- If you want to merge the content of some modules in the TypeDoc output, you can use this plugin and module annotations in your files to specify which modules should be combined.
Here is an example of how the navigation menu of TypeDoc's output changes when merging all modules into the project root using the plugin:
This module can be installed using npm:
$ npm install typedoc-plugin-merge-modules --save-dev
The plugin requires TypeDoc version 0.26.x to be installed. After installation you need to activate the plugin with a typedoc command line argument or inside your typedoc config file.
Here is an example using a JavaScript config file:
/** @type { import('typedoc').TypeDocOptionMap & import('typedoc-plugin-merge-modules').Config } */
module.exports = {
out: "output",
entryPointStrategy: "expand",
entryPoints: ["input/module1.ts", "input/module2.ts"],
tsconfig: "tsconfig.json",
readme: "MAIN.md",
plugin: ["typedoc-plugin-merge-modules"],
mergeModulesRenameDefaults: true, // NEW option of TypeDoc added by this plugin
mergeModulesMergeMode: "project", // NEW option of TypeDoc added by this plugin
};
After installation TypeDoc can be used normally and you can configure this plugin as described below.
The following options are added to TypeDoc when the plugin is installed:
Name & Format | Description | Default |
---|---|---|
mergeModulesRenameDefaults <boolean> |
Defines if the plugin should rename default exports to their original name. | true |
mergeModulesMergeMode <"project"|"module"|"module-category"|"off"> |
Defines how the plugin should merge modules:
|
"project" |
When you set mergeModulesMergeMode
to "module"
OR "module-category"
in combination with module comments you should add the tag @mergeTarget
to the comment of the module whose comment should be used in the merge result.
Please report bugs here. Thanks for your contribution!
Special thanks go to the following people that contributed to this project:
- Gerrit Birkeland for the suggested solution and code example.
- Felipe Santos for suggesting improvements.
- Sho Otani for implementing the merging of modules by name.
If you find this piece of software helpful, please consider a donation. Any amount is greatly appreciated.