Skip to content

Commit

Permalink
fix: merge pdf options into defaults properly
Browse files Browse the repository at this point in the history
  • Loading branch information
simonhaenisch committed Jan 20, 2019
1 parent 3780f30 commit d13f5e2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = async (mdFile, config) => {
const port = await getPort();
const server = await serveDirectory(getDir(mdFile), port);

config = { ...defaultConfig, ...config };
config = { ...defaultConfig, ...config, pdf_options: { ...defaultConfig.pdf_options, ...config.pdf_options } };

const pdf = await mdToPdf(mdFile, config, port);

Expand Down
46 changes: 23 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion util/md-to-pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ module.exports = async (mdFile, config, port, args = {}) => {
const { content: md, data: frontMatterConfig } = grayMatter(mdFileContent);

// merge front-matter config
config = { ...config, ...frontMatterConfig };
config = {
...config,
...frontMatterConfig,
pdf_options: { ...config.pdf_options, ...frontMatterConfig.pdf_options },
};

// sanitize array cli arguments
for (const option of ['stylesheet', 'body_class']) {
Expand Down

0 comments on commit d13f5e2

Please sign in to comment.