gulp-documentation

3.2.1 • Public • Published

gulp-documentation

Circle CI Greenkeeper badge

Use gulp with documentation to generate great documentation for your JavaScript projects.

Installation

$ npm install --save-dev gulp-documentation

API

documentation

Documentation stream intended for use within the gulp system.

Parameters

  • format string? format - one of 'html', 'md', or 'json' (optional, default md)
  • options Object documentation options - the same as given to documentation
    • options.filename string custom filename for md or json output
  • formatterOptions Object output options - same as given to documentation
    • formatterOptions.name Object if format is HTML, specifies the name of the project

Examples

var gulpDocumentation = require('gulp-documentation');
var gulp = require('gulp');
//  Out of the box, you can generate JSON, HTML, and Markdown documentation
gulp.task('documentation-readme-example', function () {
  // Generating README documentation
  return gulp.src('./index.js')
    .pipe(gulpDocumentation('md'))
    .pipe(gulp.dest('md-documentation'));
});
 
// Generating a pretty HTML documentation site
gulp.task('documentation-html-example', function () {
  return gulp.src('./index.js')
    .pipe(gulpDocumentation('html'))
    .pipe(gulp.dest('html-documentation'));
});
 
// Generating raw JSON documentation output
gulp.task('documentation-json-example', function () {
  return gulp.src('./index.js')
    .pipe(gulpDocumentation('json'))
    .pipe(gulp.dest('json-documentation'));
});
 
// Generate documentation for multiple files using normal glob syntax.
// Note that this generates one documentation output, so that it can
// easily cross-reference and use types.
gulp.task('documentation-multiple-files', function () {
  return gulp.src('./src/*.js')
    .pipe(gulpDocumentation('md'))
    .pipe(gulp.dest('md-documentation'));
});
 
 
// If you're using HTML documentation, you can specify additional 'name'
// and 'version' options
gulp.task('documentation-html-options', function () {
  return gulp.src('./src/*.js')
    .pipe(gulpDocumentation('html', {}, {
      name: 'My Project',
      version: '1.0.0'
    }))
    .pipe(gulp.dest('html-documentation'));
});
 
// Document non-JavaScript files with JSDoc comments using polyglot: true
gulp.task('documentation-for-cplusplus', function () {
  return gulp.src('./src/*.cpp')
    .pipe(gulpDocumentation('html', { polyglot: true }, {
      name: 'My Project',
      version: '1.0.0'
    }))
    .pipe(gulp.dest('html-documentation'));
});

Returns stream.Transform

Dependents (22)

Package Sidebar

Install

npm i gulp-documentation

Weekly Downloads

407

Version

3.2.1

License

BSD-2-Clause

Last publish

Collaborators

  • tmcw