Markdown Plugin
Overview
By default, JSDoc treats text in descriptions as HTML. The built-in plugins/markdown plugin parses descriptions as Markdown, letting you use headings, lists, code fences, and other Markdown syntax.
Enabling the plugin
Add plugins/markdown to the plugins array in your configuration file:
Add to your jsdoc.json
{"plugins": ["plugins/markdown"]}Usage
Once enabled, write Markdown directly in your descriptions:
/**
* Fetch a user by ID.
*
* ## Example
*
* ```js
* const user = await getUser(42);
* console.log(user.name);
* ```
*
* @param {number} id - The user's numeric ID.
* @returns {Promise<User>} The resolved user object.
*/
async function getUser(id) {}
Configuration
The plugin exposes a small number of options under markdown in your config file:
{
"plugins": ["plugins/markdown"],
"markdown": {
"hardwrap": false,
"idInHeadings": false,
"tags": ["description", "summary", "classdesc", "param", "property", "returns", "see", "throws"]
}
}
| Option | Type | Default | Description |
|---|---|---|---|
hardwrap | boolean | false | Treat newlines as hard line breaks. |
idInHeadings | boolean | false | Add id attributes to headings in the output. |
tags | string[] | (several) | Tag names whose values should be parsed as Markdown. |
See also
Official reference: jsdoc.app/plugins-markdown