Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
markdown-pdf
Advanced tools
Node module that converts Markdown files to PDFs.
The PDF looks great because it is styled by HTML5 Boilerplate. What? - Yes! Your Markdown is first converted to HTML, then pushed into the HTML5 Boilerplate index.html
. Phantomjs renders the page and saves it to a PDF. You can even customise the style of the PDF by passing an optional path to your CSS and you can pre-process your markdown file before it is converted to a PDF by passing in a pre-processing function, for templating.
npm install markdown-pdf
Pass markdown-pdf a path to a markdown document or an array of paths and you'll be given back a path or an array of paths to temporary files that contain your converted PDFs.
var markdownpdf = require("markdown-pdf")
, fs = require("fs")
markdownpdf("/path/to/document.md", function (er, pdfPath) {
if (er) return console.error(er)
// Move the pdf from the tmp path to where you want it
fs.rename(pdfPath, "/path/to/document.pdf", function() {
console.log("done")
})
})
Pass options to markdown-pdf like so:
var markdownpdf = require("markdown-pdf")
, opts = {/* options */}
markdownpdf("/path/to/document.md", opts, function (er, pdfs) {})
Type: String
Default value: Path provided by phantomjs module
Path to phantom binary
Type: Boolean
Default value: false
If set to true, a single PDF will be created containing the contents of all of the Markdown files.
Type: String
Default value: ../pdf.css
Path to custom CSS file, relative to the current working directory
Type: String
Default value: A4
'A3', 'A4', 'A5', 'Legal', 'Letter' or 'Tabloid'
Type: String
Default value: portrait
'portrait' or 'landscape'
Type: String
Default value: 1cm
Supported dimension units are: 'mm', 'cm', 'in', 'px'
Type: Number
Default value: 1000
Delay in millis before rendering the PDF (give HTML and CSS a chance to load)
Type: Function
Default value: null
Function to call before Markdown is converted to HTML. It is passed the Markdown file contents and must return a string
Type: Function
Default value: null
Function to call after Markdown has been converted to HTML but before it is converted to PDF. It is passed the Markdown file contents and must return a string
FAQs
Markdown to PDF converter
The npm package markdown-pdf receives a total of 4,086 weekly downloads. As such, markdown-pdf popularity was classified as popular.
We found that markdown-pdf demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.