Skip to content

Commit 8aeef23

Browse files
committed
Update readme with multi-file documentation example
- Also add test-manual with examples for confirming functionality
1 parent 6903ed0 commit 8aeef23

File tree

6 files changed

+58
-4
lines changed

6 files changed

+58
-4
lines changed

README.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,41 @@ $ npm install --save-dev gulp-documentation
2323
## Example
2424

2525
```js
26-
var documentation = require('gulp-documentation'),
26+
var gulpDocumentation = require('gulp-documentation'),
2727
gulp = require('gulp');
2828

29+
/**
30+
* Out of the box, you can generate JSON, HTML, and Markdown documentation
31+
*/
2932
gulp.task('documentation', function () {
3033

34+
// Generating README documentation
3135
gulp.src('./index.js')
32-
.pipe(documentation({ format: 'md' }))
36+
.pipe(gulpDocumentation({ format: 'md' }))
3337
.pipe(gulp.dest('md-documentation'));
3438

39+
// Generating a pretty HTML documentation site
3540
gulp.src('./index.js')
36-
.pipe(documentation({ format: 'html' }))
41+
.pipe(gulpDocumentation({ format: 'html' }))
3742
.pipe(gulp.dest('html-documentation'));
3843

44+
// Generating raw JSON documentation output
3945
gulp.src('./index.js')
40-
.pipe(documentation({ format: 'json' }))
46+
.pipe(gulpDocumentation({ format: 'json' }))
4147
.pipe(gulp.dest('json-documentation'));
4248

49+
});
50+
51+
/**
52+
* Generate documentation for multiple files using normal glob syntax.
53+
* Note that this generates one documentation output, so that it can
54+
* easily cross-reference and use types.
55+
*/
56+
gulp.task('documentation', function () {
57+
58+
gulp.src('./src/*.js')
59+
.pipe(gulpDocumentation({ format: 'md' }))
60+
.pipe(gulp.dest('md-documentation'));
61+
4362
});
4463
```

test-manual/multi/gulpfile.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
var gulpDocumentation = require('../../'),
2+
gulp = require('gulp');
3+
4+
gulp.task('documentation', function () {
5+
6+
gulp.src('./src/*.js')
7+
.pipe(gulpDocumentation({ format: 'md' }))
8+
.pipe(gulp.dest('md-documentation'));
9+
10+
});
11+
12+
gulp.task('documentation-shallow', function () {
13+
14+
gulp.src('./src/*.js')
15+
.pipe(gulpDocumentation({ shallow: true, format: 'md' }))
16+
.pipe(gulp.dest('md-documentation'));
17+
18+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# aFunction
2+
3+
this is a
4+
5+
# bFunction
6+
7+
this is b
8+
9+
# cFunction
10+
11+
this is c

test-manual/multi/src/a.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/** this is a */
2+
function aFunction() {}

test-manual/multi/src/b.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/** this is b */
2+
function bFunction() {}

test-manual/multi/src/c.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/** this is c */
2+
function cFunction() {}

0 commit comments

Comments
 (0)