This is a simple Node.js module that converts Markdown files to PDF. It uses markdown-it
for Markdown to HTML conversion and puppeteer
for HTML to PDF conversion.
You can install this package using npm:
npm install --save markdown-to-pdf-converter
https://www.npmjs.com/package/markdown-to-pdf-converter
Or By Yarn:
yarn add markdown-to-pdf-converter
This package has the following dependencies:
fs
andpath
(built-in Node.js modules)markdown-it
puppeteer
Here's a simple example of how to use this module:
const convertMarkdownToPDF = require('markdown-to-pdf-converter');
const markdownFilePath = './path/to/your/markdown.md';
const pdfFilePath = './path/to/output.pdf';
convertMarkdownToPDF(markdownFilePath, pdfFilePath);
Replace './path/to/your/markdown.md'
and './path/to/output.pdf'
with the actual paths to your Markdown file and where you want the PDF to be saved, respectively.
This function converts a Markdown file to a PDF file.
markdownFilePath
(string): The path to the Markdown file to convert.pdfFilePath
(string): The path where the generated PDF file should be saved.
This function returns a Promise that resolves when the PDF file has been created successfully.
This package is licensed under the MIT license.