Plugins
What are plugins?
Plugins are Node.js modules that hook into JSDoc's processing pipeline. They can:
- Define new tags or override existing ones
- Transform the doclet tree before output is generated
- Add event handlers for parse and visit events
Enabling plugins
Add plugin paths or module names to the plugins array in your configuration file:
{
"plugins": [
"plugins/markdown",
"jsdoc-plugin-typescript"
]
}
Paths starting with plugins/ refer to built-in plugins bundled with JSDoc. Module names are resolved from node_modules.
Built-in plugins
| Plugin | Description |
|---|---|
plugins/markdown | Renders Markdown in JSDoc descriptions and tag values. |
plugins/summarize | Automatically generates a @summary from the first sentence of a description. |
Writing a plugin
A plugin is a module that exports one or more of the following:
exports.handlers = {
/** Called when a new doclet is created. */
newDoclet({ doclet }) {
if (doclet.description) {
doclet.description = doclet.description.toUpperCase();
}
},
};
exports.defineTags = function (dictionary) {
dictionary.defineTag('todo', {
mustHaveValue: true,
onTagged(doclet, tag) {
doclet.todo = doclet.todo || [];
doclet.todo.push(tag.value);
},
});
};
note
Plugin order matters — plugins are applied in the order they appear in the plugins array.
See also
Official reference: jsdoc.app/about-plugins