Skip to content

Commit b3ac8d9

Browse files
committed
feat: auto-enable displayHeaderFooter if template is set
Related to #59.
1 parent 8051c42 commit b3ac8d9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/lib/md-to-pdf.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ export const convertMdToPdf = async (input: { path: string } | { content: string
2626
pdf_options: { ...config.pdf_options, ...frontMatterConfig.pdf_options },
2727
};
2828

29+
const { headerTemplate, footerTemplate, displayHeaderFooter } = config.pdf_options;
30+
31+
if ((headerTemplate || footerTemplate) && displayHeaderFooter === undefined) {
32+
config.pdf_options.displayHeaderFooter = true;
33+
}
34+
2935
// sanitize array cli arguments
3036
for (const option of ['stylesheet', 'body_class']) {
3137
if (!Array.isArray((config as any)[option])) {

0 commit comments

Comments
 (0)