-
Notifications
You must be signed in to change notification settings - Fork 152
How to document an ES2015 module (multiple named exports)
Lloyd Brookes edited this page Apr 28, 2020
·
3 revisions
1. Say you have a ES2015 module you'd like to document.
export const pi = 3.14
export function add (a, b) {
return a + b
}
export function subtract (a, b) {
return a - b
}
2. Given that jsdoc2md only generates markdown for documented identifiers and modules, you must document each identifier you want to appear in output - including the module. Therefore, you must use @module
at the top of the file to document the module.
/**
* @module maths
*/
/**
* exported number
*/
export const pi = 3.14
/**
* Add two values.
*/
export function add (a, b) {
return a + b
}
/**
* Subtraction.
*/
export function subtract (a, b) {
return a - b
}
3. This file will now appear in jsdoc2md output (without the @module
tag it will not appear):
exported number
Kind: static constant of maths
Add two values.
Kind: static method of maths
Subtraction.
Kind: static method of maths
- Home
- How jsdoc2md works
- Additional jsdoc tags supported
- Cherry picking which documentation appears in output
- Showcase ...
- Create ...
- How To ...
- How to use with npm run
- How to use with gulp
- How to create one output file per class
- How to document a AMD module
- How to document a CommonJS module (exports)
- How to document a CommonJS module (module.exports)
- How to document an ES2015 module (multiple named exports)
- How to document an ES2015 module (single default export)
- How to document Promises (using custom tags)
- How to document a ToDo list
- How to document ES2017 features
- How to document TypeScript
- The @typicalname tag
- Linking to external resources
- Param list format options
- Listing namepaths
- Troubleshooting