Reputation: 9678
I'd like to write a custom template for a bookdown project. From the documentation of the bookdown package I read that it is possible to replace the default template with a custom one, say my_custom_template.html
, by including template: "my_custom_template.html"
in the YAML header like
bookdown::gitbook:
template: my_custom_template.html
Doing so yields the following error:
Error in rmarkdown::html_document(..., extra_dependencies = c(extra_dependencies, :
formal argument "template" matched by multiple actual arguments
Calls: <Anonymous> ... do.call -> <Anonymous> -> html_document2 -> <Anonymous>
Execution halted
Error in eval(expr, envir, enclos) :
Failed to compile the book to bookdown::gitbook
It seems to me that the default template is hardcoded and thus cannot be overriden that easily.
Is there another way to include a custom template?
Upvotes: 2
Views: 717
Reputation: 26843
Update: This has become possible since bookdown v0.8 (thanks to the PR #570).
This is not possible, and it is documented this way: In the documentation for the used function (?bookdown::gitbook
) template
is excluded from the list of available parameters to be passed to rmarkdown::html_document()
, along with toc
and theme
. This is also mentioned in the page you are linking to:
There are a few arguments of html_document() that have been hard-coded in gitbook() and you cannot change them: toc = TRUE (there must be a table of contents), theme = NULL (not using any Bootstrap themes), and template (there exists an internal GitBook template).
Upvotes: 3