Skip to content

Commit b8ba983

Browse files
committed
Merge pull request #16 from fusion-com-au/airtonix-custom-instance-of-documentation
allow usage of custom instance
2 parents 76d99df + f4b8f1e commit b8ba983

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

index.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
var through2 = require('through2'),
2-
File = require('vinyl'),
3-
documentation = require('documentation');
2+
File = require('vinyl');
43

54
/**
65
* Documentation stream intended for use within the gulp system.
@@ -9,6 +8,7 @@ var through2 = require('through2'),
98
* @param {Object} options output options
109
* @param {string} options.format either 'html', 'md', 'json', or 'docset'
1110
* @param {string} options.filename custom filename for md or json output
11+
* @param {Object} [documentation] your custom instance of documentation.js
1212
* @returns {stream.Transform}
1313
* @example
1414
* var documentation = require('./'),
@@ -39,9 +39,26 @@ var through2 = require('through2'),
3939
* }))
4040
* .pipe(gulp.dest('documentation'));
4141
* });
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+
*
4257
*/
43-
module.exports = function (options) {
58+
module.exports = function (options, documentation) {
4459
options = options || {};
60+
documentation = documentation || require('documentation');
61+
4562
var docOptions = {
4663
github : !!(options.github || options.g),
4764
shallow: options.shallow || false

0 commit comments

Comments
 (0)