Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
electron-md-to-pdf
Advanced tools
Convert Markdown to PDF in Electron apps
This simple library first converts a Markdown string to HTML (using Showdown) and then to PDF (using Chromium's built-in print functionality). This makes it possible to convert Markdown to PDF with a minimal number of dependencies in Electron apps.
npm install electron-md-to-pdf
This module exposes two functions:
mdToPdfBuffer(md, options)
, which generates a PDF from the provided Markdown string (md
) and returns it as a Buffer
mdToPdfFile(md, filePath, options)
, which generates a PDF from the provided Markdown string and saves it at the provided filePath
Both functions return promises.
The options
parameter is optional. It's an object which may contain the following values:
cssString
(String): CSS string to inject into the HTML which is generated from the Markdown string (e.g. "body { color: red; }"
)cssFiles
(String array): Array of CSS files to inject into the HTML (e.g. ["./path/to/styles.css"]
)mdFlavor
(String): Markdown flavor to use, one of ["original", "vanilla", "github"]
(see the Showdown docs). Default is "github"
pdfOptions
(Object): Options to pass to Electron's PDF print function (see the Electron docs)showdownOptions
(Object): Other options for the HTML generation (see the Showdown docs)wrapperClasses
(String): Class(es) to apply to the wrapper div
around the Markdown HTMLSee the examples on how to use the module in the main process and renderer process.
Make sure you have Node.js and Yarn installed.
git clone REPO_URL
yarn
yarn start
Suggestions and contributions are always welcome! Please first discuss changes via issue before submitting a pull request.
FAQs
Convert Markdown to PDF in Electron apps
The npm package electron-md-to-pdf receives a total of 4 weekly downloads. As such, electron-md-to-pdf popularity was classified as not popular.
We found that electron-md-to-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.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.