Generate a PDF from multiple MarkDown files.
import {pdfFromMdFiles} from 'md-files-to-pdf';
const options = {
heading: 'Example',
};
pdfFromMdFiles('path/to/md-files', 'path/to/pdf', options);
Options
{
heading?: string, // Heading at the top. Default: Folder-Name
outputHtml?: string, // Path to save the generated HTML file, helpful for debugging
generateToc?: boolean, // If true, Generate a Table of Contents at the Top of the File
}
--doc-path "path/to/md-files" // Requiered, Path to Folder with MarkDown files
--out-path "path/to/pdf" // Requiered, Path where the PDF should me saved
--heading "Example" // Optional, Heading at the top. Default: Folder-Name
--output-html "path/to/html" // Optional, save the generated HTML file, helpful for debugging
--generate-toc // Optional, Generate a Table of Contents at the Top of the File
npm run start -- --doc-path ./example_docs --out-path out.pdf --heading Doc-Test
Thanks to Simon Hänisch and Contributors for creating md-to-pdf where i looked up some code.