Reputation: 915
I have a minor change to make to the bookdown template that I'm pretty sure can't be achieved with the existing options so I'd like to make a minor tweak to the HTML template without otherwise affecting things. From the manual, I can see that the default template is 'default.html' which I can locate in the package directories.
https://bookdown.org/yihui/bookdown/html.html#bootstrap-style
But the manual just has the following about how this file is specified without the context of where this code normally lives and how you might customise it:
html_chapters(toc = TRUE, number_sections = TRUE,
fig_caption = TRUE, lib_dir = "libs",
template = bookdown_file("templates/default.html"), # <<<<<------ HERE
pandoc_args = NULL, ...,
base_format = rmarkdown::html_document,
split_bib = TRUE, page_builder = build_chapter,
split
How do I specify a custom: 'templates/default.html' in my YAML without changing anything else?
if I do:
---
...
output:
bookdown::gitbook:
template: my-template.html
---
Where my-template.html is an unedited copy of 'templates/default.html' in my project root It breaks the styling. Is there a YAML config that will let me set this without breaking the styling?
Upvotes: 1
Views: 245
Reputation: 30194
For the output format bookdown::gitbook
, it does not use the template
bookdown:::bookdown_file("templates/default.html")
but
bookdown:::bookdown_file('templates', 'gitbook.html')
instead. You should make modifications based on this gitbook.html
template.
The template default.html
is primarily for the Bootstrap style.
Upvotes: 1