What does this do?
- Finds reflinks like
[gulp][]
or[gulp]
- Resolves the
homepage
orrepository.url
from npm - Appends
[gulp]: http://gulpjs.com
to the markdown string - Does not add (duplicate) reflinks that already exist in the document
Why should I use use this?
gulp-reflinks
makes it easy to write documentation that references other libraries, by simply adding the name, like [foo][]
, without having to remember or write the entire URL to the GitHub repository.
Must be a valid npm name
For reflinks to be fixed, the reflink text must match the name of a valid npm package. For example [Foo Bar][]
won't be fixed, but [gulp][]
would.
const gulp = require('gulp');
const reflinks = require('{%= name %}');
gulp.task('default', function() {
return gulp.src('*.md')
.pipe(reflinks())
.pipe(gulp.dest('dist/'));
});