Skip to content

Commit

Permalink
feat: auto-enable displayHeaderFooter if template is set
Browse files Browse the repository at this point in the history
Related to #59.
  • Loading branch information
simonhaenisch committed Jan 26, 2020
1 parent 8051c42 commit b3ac8d9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib/md-to-pdf.ts
Expand Up @@ -26,6 +26,12 @@ export const convertMdToPdf = async (input: { path: string } | { content: string
pdf_options: { ...config.pdf_options, ...frontMatterConfig.pdf_options },
};

const { headerTemplate, footerTemplate, displayHeaderFooter } = config.pdf_options;

if ((headerTemplate || footerTemplate) && displayHeaderFooter === undefined) {
config.pdf_options.displayHeaderFooter = true;
}

// sanitize array cli arguments
for (const option of ['stylesheet', 'body_class']) {
if (!Array.isArray((config as any)[option])) {
Expand Down

0 comments on commit b3ac8d9

Please sign in to comment.