Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
letter-press
Advanced tools
Print GitHub Markdown to PDF using headless Chrome.
Print letter.md
to dist/letter.pdf
then log a completion message.
const letterpress = require('letter-press')
const letter = fs.readFileSync(path.join(__dirname, 'letter.md'))
letterpress.print('letter', letter)
.then(() => console.log('🐈 done'))
Print letters to dist/*.pdf
based on a Markdown template and some data (e.g. mailing list).
const letterpress = require('letter-press')
const letter = (sender, recipient) =>
`Dear ${recipient},
Here is some **bold text**. *Winky face*.
Yours sincerely,
${sender}
`
const list = [
{ id: 'letter1', sender: 'Your Secret Lesbian Admirer', recipient: 'John' }
// ...
];
(async () => {
const press = await letterpress.launch()
const jobs = []
list.forEach(item => {
const markdown = letter(item.sender, item.recipient)
const job = press.print(item.id, markdown)
jobs.push(job)
})
await Promise.all(jobs)
press.close()
})()
letterpress.print(id, markdown, [opts])
Print the given markdown
string to PDF. Return: Promise
Writes the following files:
dist/id.html
dist/id.pdf
letterpress.launch([opts])
Launch a new Press. Return: Promise of Press
Press.prototype.print(id, markdown, [opts])
Print the given markdown
string to PDF. Return: Promise of Press
Writes the following files:
dist/id.html
dist/id.pdf
The returned Promise resolves with the Press object so that tasks can be chained together (e.g. letterpress.launch
then press.print
then press.close
). However, it is not necessary to wait for a print
to resolve before calling print
again - print scheduling is all handled under the hood.
Press.prototype.close()
Close this Press. Call after all prints have resolved.
These options can be set at launch and/or for each print.
opts.path
Path to output folder. Default: dist
opts.quiet
Only log errors. Default: false
opts.template
Path to pug template file used when generating HTML. The template must contain a !=content
, and may contain a !=title
. Default: Template File
opts.markdown
Options passed to markdown-it new MarkdownIt(opts)
. API
opts.pdf
Options passed to puppeteer page.pdf(opts)
. API
FAQs
Print GitHub Markdown to PDF using headless Chrome.
The npm package letter-press receives a total of 2 weekly downloads. As such, letter-press popularity was classified as not popular.
We found that letter-press 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
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.