gulp-markdown-pdf
Advanced tools
+9
-29
@@ -1,31 +0,11 @@ | ||
| 'use strict'; | ||
| const through = require('through2'); | ||
| const markdownpdf = require('markdown-pdf'); | ||
| const PluginError = require('plugin-error'); | ||
| import {promisify} from 'node:util'; | ||
| import markdownpdf from 'markdown-pdf'; | ||
| import {gulpPlugin} from 'gulp-plugin-extras'; | ||
| module.exports = options => { | ||
| return through.obj((file, encoding, callback) => { | ||
| if (file.isNull()) { | ||
| callback(null, file); | ||
| return; | ||
| } | ||
| if (file.isStream()) { | ||
| callback(new PluginError('gulp-markdown-pdf', 'Streaming not supported')); | ||
| return; | ||
| } | ||
| markdownpdf(options) | ||
| .from.string(file.contents.toString()) | ||
| .to.buffer((error, buffer) => { | ||
| if (error) { | ||
| callback(new PluginError('gulp-markdown-pdf', error, {fileName: file.path})); | ||
| return; | ||
| } | ||
| file.contents = buffer; | ||
| file.extname = '.pdf'; | ||
| callback(null, file); | ||
| }); | ||
| export default function gulpMarkdownPdf(options) { | ||
| return gulpPlugin('gulp-markdown-pdf', async file => { | ||
| file.contents = await promisify(markdownpdf(options).from.string(file.contents.toString()).to.buffer)(); | ||
| file.extname = '.pdf'; | ||
| return file; | ||
| }); | ||
| }; | ||
| } |
+12
-10
| { | ||
| "name": "gulp-markdown-pdf", | ||
| "version": "8.0.0", | ||
| "version": "9.0.0", | ||
| "description": "Markdown to PDF", | ||
| "license": "MIT", | ||
| "repository": "sindresorhus/gulp-markdown-pdf", | ||
| "funding": "https://github.com/sponsors/sindresorhus", | ||
| "author": { | ||
| "name": "Sindre Sorhus", | ||
| "email": "sindresorhus@gmail.com", | ||
| "url": "sindresorhus.com" | ||
| "url": "https://sindresorhus.com" | ||
| }, | ||
| "type": "module", | ||
| "exports": "./index.js", | ||
| "engines": { | ||
| "node": ">=8" | ||
| "node": ">=18" | ||
| }, | ||
@@ -34,11 +37,10 @@ "scripts": { | ||
| "dependencies": { | ||
| "markdown-pdf": "^10.0.0", | ||
| "plugin-error": "^1.0.0", | ||
| "through2": "^3.0.0" | ||
| "gulp-plugin-extras": "^0.2.2", | ||
| "markdown-pdf": "^11.0.0" | ||
| }, | ||
| "devDependencies": { | ||
| "ava": "^2.4.0", | ||
| "p-event": "^4.1.0", | ||
| "vinyl": "^2.1.0", | ||
| "xo": "^0.25.3" | ||
| "ava": "^5.3.1", | ||
| "p-event": "^6.0.0", | ||
| "vinyl": "^3.0.0", | ||
| "xo": "^0.56.0" | ||
| }, | ||
@@ -45,0 +47,0 @@ "peerDependencies": { |
+6
-9
@@ -1,2 +0,2 @@ | ||
| # gulp-markdown-pdf [](https://travis-ci.org/sindresorhus/gulp-markdown-pdf) | ||
| # gulp-markdown-pdf | ||
@@ -7,17 +7,15 @@ > Markdown to PDF with [`markdown-pdf`](https://github.com/alanshaw/markdown-pdf) | ||
| ## Install | ||
| ```sh | ||
| npm install --save-dev gulp-markdown-pdf | ||
| ``` | ||
| $ npm install --save-dev gulp-markdown-pdf | ||
| ``` | ||
| ## Usage | ||
| ```js | ||
| const gulp = require('gulp'); | ||
| const markdownPdf = require('gulp-markdown-pdf'); | ||
| import gulp from 'gulp'; | ||
| import markdownPdf from 'gulp-markdown-pdf'; | ||
| exports.default = () => ( | ||
| export default () => ( | ||
| gulp.src('intro.md') | ||
@@ -29,3 +27,2 @@ .pipe(markdownPdf()) | ||
| ## API | ||
@@ -32,0 +29,0 @@ |
Sorry, the diff of this file is not supported yet
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
3
-25%Yes
NaN3038
-11.56%10
-62.96%31
-8.82%1
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated