gulp-markdown
Advanced tools
Comparing version
21
index.js
'use strict'; | ||
var gutil = require('gulp-util'); | ||
var through = require('through2'); | ||
var marked = require('marked'); | ||
const through = require('through2'); | ||
const marked = require('marked'); | ||
const PluginError = require('plugin-error'); | ||
const replaceExt = require('replace-ext'); | ||
module.exports = function (options) { | ||
return through.obj(function (file, enc, cb) { | ||
module.exports = options => { | ||
return through.obj((file, enc, cb) => { | ||
if (file.isNull()) { | ||
@@ -14,14 +15,14 @@ cb(null, file); | ||
if (file.isStream()) { | ||
cb(new gutil.PluginError('gulp-markdown', 'Streaming not supported')); | ||
cb(new PluginError('gulp-markdown', 'Streaming not supported')); | ||
return; | ||
} | ||
marked(file.contents.toString(), options, function (err, data) { | ||
marked(file.contents.toString(), options, (err, data) => { | ||
if (err) { | ||
cb(new gutil.PluginError('gulp-markdown', err, {fileName: file.path})); | ||
cb(new PluginError('gulp-markdown', err, {fileName: file.path})); | ||
return; | ||
} | ||
file.contents = new Buffer(data); | ||
file.path = gutil.replaceExtension(file.path, '.html'); | ||
file.contents = Buffer.from(data); | ||
file.path = replaceExt(file.path, '.html'); | ||
@@ -28,0 +29,0 @@ cb(null, file); |
{ | ||
"name": "gulp-markdown", | ||
"version": "1.2.0", | ||
"description": "Markdown to HTML", | ||
"license": "MIT", | ||
"repository": "sindresorhus/gulp-markdown", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "http://sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"gulpplugin", | ||
"markdown", | ||
"marked", | ||
"md", | ||
"compile", | ||
"convert", | ||
"markup", | ||
"html" | ||
], | ||
"dependencies": { | ||
"gulp-util": "^3.0.0", | ||
"marked": "^0.3.2", | ||
"through2": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "*" | ||
} | ||
"name": "gulp-markdown", | ||
"version": "2.0.0", | ||
"description": "Markdown to HTML", | ||
"license": "MIT", | ||
"repository": "sindresorhus/gulp-markdown", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"gulpplugin", | ||
"markdown", | ||
"marked", | ||
"md", | ||
"compile", | ||
"convert", | ||
"markup", | ||
"html" | ||
], | ||
"dependencies": { | ||
"marked": "^0.3.9", | ||
"plugin-error": "^0.1.2", | ||
"replace-ext": "^1.0.0", | ||
"through2": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"vinyl": "^2.1.0", | ||
"xo": "*" | ||
} | ||
} |
# gulp-markdown [](https://travis-ci.org/sindresorhus/gulp-markdown) | ||
> Markdown to HTML with [marked](https://github.com/chjj/marked) | ||
> Markdown to HTML with [`marked`](https://github.com/chjj/marked) | ||
*Issues with the output should be reported on the marked [issue tracker](https://github.com/chjj/marked/issues).* | ||
*Issues with the output should be reported on the `marked` [issue tracker](https://github.com/chjj/marked/issues).* | ||
@@ -18,10 +18,10 @@ | ||
```js | ||
var gulp = require('gulp'); | ||
var markdown = require('gulp-markdown'); | ||
const gulp = require('gulp'); | ||
const markdown = require('gulp-markdown'); | ||
gulp.task('default', function () { | ||
return gulp.src('intro.md') | ||
gulp.task('default', () => | ||
gulp.src('intro.md') | ||
.pipe(markdown()) | ||
.pipe(gulp.dest('dist')); | ||
}); | ||
.pipe(gulp.dest('dist')) | ||
); | ||
``` | ||
@@ -32,5 +32,5 @@ | ||
### markdown(options) | ||
### markdown([options]) | ||
See the marked [options](https://github.com/chjj/marked#options-1). | ||
See the `marked` [options](https://github.com/chjj/marked#options-1). | ||
@@ -44,2 +44,2 @@ ### markdown.marked | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
Sorry, the diff of this file is not supported yet
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
27
3.85%4
33.33%3
200%2
100%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated