gulp-jsdoc-to-markdown

Plugin for jsdoc-to-markdown. Works in both buffer and streaming modes.

MIT 18 个版本
安装
npm install gulp-jsdoc-to-markdown
yarn add gulp-jsdoc-to-markdown
pnpm add gulp-jsdoc-to-markdown
bun add gulp-jsdoc-to-markdown
README

view on npm npm module downloads Build Status Dependency Status js-standard-style

gulp-jsdoc-to-markdown

Plugin for jsdoc-to-markdown. Works in both buffer and streaming modes.

Caveat

If you intend to use this plugin and your code has modules, you must always supply a name with the @module tag.

In other words @module will fail, @module my-module will win.

If the module name is not provided, jsdoc will try to infer it from the filename of the module. However, gulp deals with streams - not files. And that stream could come from anywhere. We do not know the file name so we cannot infer the module name - so always supply it. More info here.

gulpfile.js examples

One markdown file out per source file in

'use strict'
var fs = require('fs')
var gulp = require('gulp')
var gutil = require('gulp-util')
var gulpJsdoc2md = require('gulp-jsdoc-to-markdown')
var rename = require('gulp-rename')
var concat = require('gulp-concat')

gulp.task('docs', function () {
  return gulp.src('lib/*.js')
    .pipe(gulpJsdoc2md({ template: fs.readFileSync('./readme.hbs', 'utf8') }))
    .on('error', function (err) {
      gutil.log(gutil.colors.red('jsdoc2md failed'), err.message)
    })
    .pipe(rename(function (path) {
      path.extname = '.md'
    }))
    .pipe(gulp.dest('api'))
})

Multiple source files in, a single markdown file out

'use strict'
var fs = require('fs')
var gulp = require('gulp')
var gutil = require('gulp-util')
var gulpJsdoc2md = require('gulp-jsdoc-to-markdown')
var concat = require('gulp-concat')

gulp.task('docs', function () {
  return gulp.src('lib/*.js')
    .pipe(concat('all.md'))
    .pipe(gulpJsdoc2md({ template: fs.readFileSync('./readme.hbs', 'utf8') }))
    .on('error', function (err) {
      gutil.log('jsdoc2md failed:', err.message)
    })
    .pipe(gulp.dest('api'))
})

Install

Install this plugin:

$ npm install gulp-jsdoc-to-markdown --save-dev

If using one of the example gulpfiles above you will also need to run:

$ npm i gulp gulp-util gulp-concat gulp-rename --save-dev

© 2014-16 Lloyd Brookes <75pound@gmail.com>.

版本列表
1.2.2 2016-04-16
1.2.1 2016-01-04
1.2.0 2015-12-09
1.1.2 2015-12-05
1.1.1 2015-05-08
1.1.0 2015-05-05
1.0.2 2015-04-15
1.0.1 2015-04-12
1.0.0 2015-04-12
0.2.0 2015-03-23
0.1.7 2015-03-23
0.1.6 2014-12-26
0.1.5 2014-09-30
0.1.4 2014-09-09
0.1.3 2014-07-19
0.1.2 2014-07-19
0.1.1 2014-07-19
0.1.0 2014-07-19