Reputation: 3242
Using the below YAML header with the rest of the file blank, doesn't render, due to issue with chrome_print
arugment not used in a proper syntax way. How can I correctly use this argument?
---
title: "A Multi-page HTML Document"
author: "Yihui Xie and Romain Lesur"
date: "`r Sys.Date()`"
output: pagedown::html_paged
knit: pagedown::chrome_print(timeout=50)
---
from the Pagedown documentation and here it discusses using chrome_print()
to print rendered documents using headless chrome... but I am not able to correctly apply this argument to force the rendering process to go over the default 30 seconds.
I get the error below when attempting to render
syntax error near unexpected token `timeout=50'
Thank you!
Upvotes: 1
Views: 196
Reputation: 19867
Try this way,
---
title: "A Multi-page HTML Document"
author: "Yihui Xie and Romain Lesur"
date: "`r Sys.Date()`"
output: pagedown::html_paged
knit: (function(inputFile, encoding) {
pagedown::chrome_print(inputFile,
encoding = encoding,
timeout = 50)})
---
Now, why do we need to wrap pagedown::chrome_print
inside a function to use the timeout
argument and then wrap the whole function inside a parenthesis?
From the section 17.5 of Rmarkdown Cookbook, Customizing the knit button,
It is possible to control the behavior of the Knit button by providing the
knit
field within the YAML frontmatter of your document. The field takes a function with the main argumentinput
(the path to the input Rmd document) and other arguments that are currently ignored.
If you store the code directly within YAML, you must wrap the entire function in parentheses. If the source code has multiple lines, you have to indent all lines (except the first line) by at least two spaces.
Upvotes: 2