markdown-pdf
Advanced tools
Comparing version 9.0.0 to 10.0.0
@@ -6,3 +6,3 @@ var fs = require('fs') | ||
var extend = require('extend') | ||
var Remarkable = require('remarkable') | ||
var { Remarkable } = require('remarkable') | ||
var hljs = require('highlight.js') | ||
@@ -29,3 +29,3 @@ var tmp = require('tmp') | ||
opts.preProcessHtml = opts.preProcessHtml || function () { return through() } | ||
opts.remarkable = extend({breaks: true}, opts.remarkable) | ||
opts.remarkable = extend({ breaks: true }, opts.remarkable) | ||
opts.remarkable.preset = opts.remarkable.preset || 'default' | ||
@@ -91,3 +91,3 @@ opts.remarkable.plugins = opts.remarkable.plugins || [] | ||
// Create tmp file to save HTML for phantom to process | ||
tmp.file({postfix: '.html'}, function (err, tmpHtmlPath, tmpHtmlFd) { | ||
tmp.file({ postfix: '.html' }, function (err, tmpHtmlPath, tmpHtmlFd) { | ||
if (err) return outputStream.emit('error', err) | ||
@@ -97,3 +97,3 @@ fs.closeSync(tmpHtmlFd) | ||
// Create tmp file to save PDF to | ||
tmp.file({postfix: '.pdf'}, function (err, tmpPdfPath, tmpPdfFd) { | ||
tmp.file({ postfix: '.pdf' }, function (err, tmpPdfPath, tmpPdfFd) { | ||
if (err) return outputStream.emit('error', err) | ||
@@ -100,0 +100,0 @@ fs.closeSync(tmpPdfFd) |
{ | ||
"name": "markdown-pdf", | ||
"version": "9.0.0", | ||
"version": "10.0.0", | ||
"description": "Markdown to PDF converter", | ||
@@ -24,18 +24,18 @@ "main": "index.js", | ||
"dependencies": { | ||
"commander": "^2.2.0", | ||
"commander": "^3.0.0", | ||
"duplexer": "^0.1.1", | ||
"extend": "^3.0.0", | ||
"highlight.js": "^9.1.0", | ||
"extend": "^3.0.2", | ||
"highlight.js": "^9.15.9", | ||
"phantomjs-prebuilt": "^2.1.3", | ||
"remarkable": "^1.7.1", | ||
"remarkable": "^2.0.0", | ||
"stream-from-to": "^1.4.2", | ||
"through2": "^2.0.0", | ||
"tmp": "0.0.33" | ||
"through2": "^3.0.1", | ||
"tmp": "^0.1.0" | ||
}, | ||
"devDependencies": { | ||
"coveralls": "^3.0.2", | ||
"coveralls": "^3.0.6", | ||
"istanbul": "^0.4.0", | ||
"pdf-text": "^0.4.0", | ||
"standard": "^11.0.1", | ||
"tape": "^4.2.2" | ||
"standard": "^13.1.0", | ||
"tape": "^4.11.0" | ||
}, | ||
@@ -42,0 +42,0 @@ "engines": { |
@@ -40,3 +40,3 @@ var system = require('system') | ||
// Set the PDF paper size | ||
page.paperSize = paperSize(args.runningsPath, {format: args.paperFormat, orientation: args.paperOrientation, border: isJson(args.paperBorder) ? JSON.parse(args.paperBorder) : args.paperBorder}) | ||
page.paperSize = paperSize(args.runningsPath, { format: args.paperFormat, orientation: args.paperOrientation, border: isJson(args.paperBorder) ? JSON.parse(args.paperBorder) : args.paperBorder }) | ||
@@ -43,0 +43,0 @@ args.renderDelay = parseInt(args.renderDelay, 10) |
@@ -11,5 +11,7 @@ markdown-pdf [![Build Status](https://travis-ci.org/alanshaw/markdown-pdf.svg)](https://travis-ci.org/alanshaw/markdown-pdf) [![Dependency Status](https://david-dm.org/alanshaw/markdown-pdf.svg)](https://david-dm.org/alanshaw/markdown-pdf) [![Coverage Status](https://img.shields.io/coveralls/alanshaw/markdown-pdf.svg?style=flat)](https://coveralls.io/r/alanshaw/markdown-pdf?branch=master) | ||
```sh | ||
npm install -g markdown-pdf | ||
npm install -g markdown-pdf --ignore-scripts | ||
``` | ||
Note: elevated (sudo) permissions may be needed for `npm install -g` | ||
## Usage | ||
@@ -61,3 +63,3 @@ | ||
#### options.cwd | ||
Type: `String` | ||
Type: `String` | ||
Default value: `process.cwd()` | ||
@@ -68,3 +70,3 @@ | ||
#### options.phantomPath | ||
Type: `String` | ||
Type: `String` | ||
Default value: Path provided by phantomjs module | ||
@@ -75,3 +77,3 @@ | ||
#### options.cssPath | ||
Type: `String` | ||
Type: `String` | ||
Default value: `[module path]/markdown-pdf/css/pdf.css` | ||
@@ -82,3 +84,3 @@ | ||
#### options.highlightCssPath | ||
Type: `String` | ||
Type: `String` | ||
Default value: `[module path]/markdown-pdf/css/highlight.css` | ||
@@ -89,3 +91,3 @@ | ||
#### options.paperFormat | ||
Type: `String` | ||
Type: `String` | ||
Default value: `A4` | ||
@@ -96,3 +98,3 @@ | ||
#### options.paperOrientation | ||
Type: `String` | ||
Type: `String` | ||
Default value: `portrait` | ||
@@ -103,3 +105,3 @@ | ||
#### options.paperBorder | ||
Type: `String` | ||
Type: `String` | ||
Default value: `2cm` | ||
@@ -110,3 +112,3 @@ | ||
#### options.runningsPath | ||
Type: `String` | ||
Type: `String` | ||
Default value: `runnings.js` | ||
@@ -117,3 +119,3 @@ | ||
#### options.renderDelay | ||
Type: `Number` | ||
Type: `Number` | ||
Default value: Time until [`page.onLoadFinished`](http://phantomjs.org/api/webpage/handler/on-load-finished.html) event fired | ||
@@ -124,3 +126,3 @@ | ||
#### options.loadTimeout | ||
Type: `Number` | ||
Type: `Number` | ||
Default value: `10000` | ||
@@ -131,3 +133,3 @@ | ||
#### options.preProcessMd | ||
Type: `Function` | ||
Type: `Function` | ||
Default value: `function () { return through() }` | ||
@@ -138,3 +140,3 @@ | ||
#### options.preProcessHtml | ||
Type: `Function` | ||
Type: `Function` | ||
Default value: `function () { return through() }` | ||
@@ -145,3 +147,3 @@ | ||
#### options.remarkable | ||
Type: `object` | ||
Type: `object` | ||
Default value: `{ breaks: true }` | ||
@@ -160,3 +162,3 @@ | ||
##### options.remarkable.plugins | ||
Type: `Array` of remarkable-plugin `Function`s | ||
Type: `Array` of remarkable-plugin `Function`s | ||
Default value: `[]` | ||
@@ -167,3 +169,3 @@ | ||
##### options.remarkable.syntax | ||
Type: `Array` of optional remarkable syntax `Strings`s | ||
Type: `Array` of optional remarkable syntax `Strings`s | ||
Default value: `[]` | ||
@@ -293,3 +295,3 @@ | ||
Feel free to dive in! [Open an issue](https://github.com/tableflip/mem-storage-area/issues/new) or submit PRs. | ||
Feel free to dive in! [Open an issue](https://github.com/alanshaw/markdown-pdf/issues/new) or submit PRs. | ||
@@ -296,0 +298,0 @@ ## License |
@@ -14,3 +14,3 @@ var fs = require('fs') | ||
tmp.file({postfix: '.pdf'}, function (er, tmpPdfPath, tmpPdfFd) { | ||
tmp.file({ postfix: '.pdf' }, function (er, tmpPdfPath, tmpPdfFd) { | ||
t.ifError(er) | ||
@@ -23,3 +23,3 @@ fs.closeSync(tmpPdfFd) | ||
// Read the file | ||
fs.readFile(tmpPdfPath, {encoding: 'utf8'}, function (er, data) { | ||
fs.readFile(tmpPdfPath, { encoding: 'utf8' }, function (er, data) { | ||
t.ifError(er) | ||
@@ -37,3 +37,3 @@ // Test not empty | ||
tmp.file({postfix: '.pdf'}, function (er, tmpPdfPath, tmpPdfFd) { | ||
tmp.file({ postfix: '.pdf' }, function (er, tmpPdfPath, tmpPdfFd) { | ||
t.ifError(er) | ||
@@ -48,3 +48,3 @@ fs.closeSync(tmpPdfFd) | ||
// Read the file | ||
fs.readFile(tmpPdfPath, {encoding: 'utf8'}, function (er, data) { | ||
fs.readFile(tmpPdfPath, { encoding: 'utf8' }, function (er, data) { | ||
t.ifError(er) | ||
@@ -68,11 +68,11 @@ // Test not empty | ||
tmp.file({postfix: '.pdf'}, function (er, tmpPdfPath, tmpPdfFd) { | ||
tmp.file({ postfix: '.pdf' }, function (er, tmpPdfPath, tmpPdfFd) { | ||
t.ifError(er) | ||
fs.closeSync(tmpPdfFd) | ||
markdownpdf({runningsPath: path.join(__dirname, '/fixtures/runnings.js')}).from(path.join(__dirname, '/fixtures/ipsum.md')).to(tmpPdfPath, function (er) { | ||
markdownpdf({ runningsPath: path.join(__dirname, '/fixtures/runnings.js') }).from(path.join(__dirname, '/fixtures/ipsum.md')).to(tmpPdfPath, function (er) { | ||
t.ifError(er) | ||
// Read the file | ||
fs.readFile(tmpPdfPath, {encoding: 'utf8'}, function (er, data) { | ||
fs.readFile(tmpPdfPath, { encoding: 'utf8' }, function (er, data) { | ||
t.ifError(er) | ||
@@ -101,3 +101,3 @@ // Test not empty | ||
markdownpdf({preProcessMd: preProcessMd}).from(path.join(__dirname, '/fixtures/ipsum.md')).to.string(function (er, pdfStr) { | ||
markdownpdf({ preProcessMd: preProcessMd }).from(path.join(__dirname, '/fixtures/ipsum.md')).to.string(function (er, pdfStr) { | ||
t.ifError(er) | ||
@@ -118,3 +118,3 @@ | ||
markdownpdf({preProcessHtml: preProcessHtml}).from(path.join(__dirname, '/fixtures/ipsum.md')).to.string(function (er, pdfStr) { | ||
markdownpdf({ preProcessHtml: preProcessHtml }).from(path.join(__dirname, '/fixtures/ipsum.md')).to.string(function (er, pdfStr) { | ||
t.ifError(er) | ||
@@ -137,3 +137,3 @@ | ||
tmp.file({postfix: '.pdf'}, function (er, tmpPdfPath, tmpPdfFd) { | ||
tmp.file({ postfix: '.pdf' }, function (er, tmpPdfPath, tmpPdfFd) { | ||
t.ifError(er) | ||
@@ -146,3 +146,3 @@ fs.closeSync(tmpPdfFd) | ||
// Read the file | ||
fs.readFile(tmpPdfPath, {encoding: 'utf8'}, function (er, data) { | ||
fs.readFile(tmpPdfPath, { encoding: 'utf8' }, function (er, data) { | ||
t.ifError(er) | ||
@@ -165,7 +165,7 @@ // Test not empty | ||
tmp.file({postfix: '.pdf'}, function (er, tmpPdfPath0, tmpPdfFd0) { | ||
tmp.file({ postfix: '.pdf' }, function (er, tmpPdfPath0, tmpPdfFd0) { | ||
t.ifError(er) | ||
fs.closeSync(tmpPdfFd0) | ||
tmp.file({postfix: '.pdf'}, function (er, tmpPdfPath1, tmpPdfFd1) { | ||
tmp.file({ postfix: '.pdf' }, function (er, tmpPdfPath1, tmpPdfFd1) { | ||
t.ifError(er) | ||
@@ -178,4 +178,4 @@ fs.closeSync(tmpPdfFd1) | ||
// Read the file | ||
var content0 = fs.readFileSync(tmpPdfPath0, {encoding: 'utf8'}) | ||
var content1 = fs.readFileSync(tmpPdfPath1, {encoding: 'utf8'}) | ||
var content0 = fs.readFileSync(tmpPdfPath0, { encoding: 'utf8' }) | ||
var content1 = fs.readFileSync(tmpPdfPath1, { encoding: 'utf8' }) | ||
@@ -197,3 +197,3 @@ t.ok(content0.length > 0) | ||
var opts = { | ||
remarkable: {preset: 'full'}, | ||
remarkable: { preset: 'full' }, | ||
preProcessHtml: function () { | ||
@@ -237,3 +237,3 @@ return through( | ||
markdownpdf({remarkable: remarkableOpts}).from(path.join(__dirname, '/fixtures/ipsum.md')).to.string(function (er, pdfStr) { | ||
markdownpdf({ remarkable: remarkableOpts }).from(path.join(__dirname, '/fixtures/ipsum.md')).to.string(function (er, pdfStr) { | ||
t.ifError(er) | ||
@@ -240,0 +240,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
253013
284
5
+ Addedautolinker@3.16.2(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedcommander@3.0.2(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedremarkable@2.0.1(transitive)
+ Addedrimraf@2.7.1(transitive)
+ Addedthrough2@3.0.2(transitive)
+ Addedtmp@0.1.0(transitive)
+ Addedtslib@2.8.1(transitive)
+ Addedwrappy@1.0.2(transitive)
- Removedautolinker@0.28.1(transitive)
- Removedcommander@2.20.3(transitive)
- Removedconcat-with-sourcemaps@1.1.0(transitive)
- Removedgulp-header@1.8.12(transitive)
- Removedlodash._reinterpolate@3.0.0(transitive)
- Removedlodash.template@4.5.0(transitive)
- Removedlodash.templatesettings@4.2.0(transitive)
- Removedos-tmpdir@1.0.2(transitive)
- Removedremarkable@1.7.4(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedthrough2@2.0.5(transitive)
- Removedtmp@0.0.33(transitive)
- Removedxtend@4.0.2(transitive)
Updatedcommander@^3.0.0
Updatedextend@^3.0.2
Updatedhighlight.js@^9.15.9
Updatedremarkable@^2.0.0
Updatedthrough2@^3.0.1
Updatedtmp@^0.1.0