-
Notifications
You must be signed in to change notification settings - Fork 151
How to use with gulp
Lloyd Brookes edited this page Oct 19, 2016
·
10 revisions
1. Install jsdoc2md in your project. For the async example below, I'm also using fs-then-native.
$ npm i jsdoc-to-markdown fs-then-native --save-dev
2. Add a simple task to your gulpfile.js (consult the API docs for instructions how to use jsdoc2md.render
)
gulp.task('docs', function () {
const fs = require('fs-then-native')
const jsdoc2md = require('jsdoc-to-markdown')
return jsdoc2md.render({ files: 'lib/*.js' })
.then(output => fs.writeFile('api.md', output))
.catch(err => {
console.err(err.stack)
})
})
3. Or, the synchronous equivalent (node v0.12.0 and over):
gulp.task('docs', function () {
const fs = require('fs')
const jsdoc2md = require('jsdoc-to-markdown')
const output = jsdoc2md.renderSync({ files: 'lib/*.js' })
fs.writeFileSync('docs/api.md', output)
})
- 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