https://github.com/pirosikick/gulp-comment2md
Generates markdown files from JavaScript comments
https://github.com/pirosikick/gulp-comment2md
Last synced: about 2 months ago
JSON representation
Generates markdown files from JavaScript comments
- Host: GitHub
- URL: https://github.com/pirosikick/gulp-comment2md
- Owner: pirosikick
- License: mit
- Created: 2015-03-20T07:46:06.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-07-13T17:07:23.000Z (almost 10 years ago)
- Last Synced: 2025-04-03T21:39:34.199Z (2 months ago)
- Language: JavaScript
- Size: 157 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](http://badge.fury.io/js/gulp-comment2md)
[](https://david-dm.org/pirosikick/gulp-comment2md)
[](https://travis-ci.org/pirosikick/gulp-comment2md)# gulp-comment2md
gulp-commnet2md is a gulp plugin that generates markdown file from JavaScript comments.
## Install
```sh
$ npm install gulp-comment2md --save-dev
```## Example
gulp-comment2md generates markdown file from block comments which start with `/**md` or `/*markdown`:
```javascript
// src/hello.js/**md
* # THIS FILE IS IMPORTANT!!!
*
* - one
* - two
* - three
*
*/
function hello() {
console.log('hello world');
}
``````javascript
// gulpfile.jsvar gulp = require('gulp');
var comment2md = require('gulp-comment2md');gulp.task('markdown', function () {
gulp.src('./src/**/*.js')
.pipe(comment2md())
.pipe(gulp.dest('./doc')); // This task will generate `doc/hello.md`
});
```### Rename output file
If you want to rename output markdown files, you can pass String or Function as
comment2md argument:```javascript
// String
gulp.task('markdown', function () {
gulp.src('./src/**/*.js')
.pipe(comment2md("new-name.md"))
.pipe(gulp.dest('./doc')); // This task will generate `doc/new-name.md`
});// Function
function rename (file) {
return 'new-name.md';
}gulp.task('markdown', function () {
gulp.src('./src/**/*.js')
.pipe(comment2md(rename))
.pipe(gulp.dest('./doc')); // This task will generate `doc/new-name.md`
});
```## License
MIT