1
1
var through2 = require ( 'through2' ) ,
2
- File = require ( 'vinyl' ) ,
3
- documentation = require ( 'documentation' ) ;
2
+ File = require ( 'vinyl' ) ;
4
3
5
4
/**
6
5
* Documentation stream intended for use within the gulp system.
@@ -9,6 +8,7 @@ var through2 = require('through2'),
9
8
* @param {Object } options output options
10
9
* @param {string } options.format either 'html', 'md', 'json', or 'docset'
11
10
* @param {string } options.filename custom filename for md or json output
11
+ * @param {Object } [documentation] your custom instance of documentation.js
12
12
* @returns {stream.Transform }
13
13
* @example
14
14
* var documentation = require('./'),
@@ -39,9 +39,26 @@ var through2 = require('through2'),
39
39
* }))
40
40
* .pipe(gulp.dest('documentation'));
41
41
* });
42
+ *
43
+ *
44
+ * // documentation with JSON output, default filename API.md and custom Documentation instance
45
+ * var documentation = require('gulp-documentation'),
46
+ * $documentation = require('documentation');
47
+ *
48
+ *
49
+ * gulp.task('documentation-json', function () {
50
+ * gulp.src('./index.js')
51
+ * .pipe(documentation({
52
+ * format: 'json'
53
+ * }, $documentation))
54
+ * .pipe(gulp.dest('documentation'));
55
+ * });
56
+ *
42
57
*/
43
- module . exports = function ( options ) {
58
+ module . exports = function ( options , documentation ) {
44
59
options = options || { } ;
60
+ documentation = documentation || require ( 'documentation' ) ;
61
+
45
62
var docOptions = {
46
63
github : ! ! ( options . github || options . g ) ,
47
64
shallow : options . shallow || false
0 commit comments