问题
bookdown::gitbook()
adds the content of https://github.com/rstudio/bookdown/tree/master/inst/resources/gitbook as a htmltools::htmlDependency
. How can I add such a custom dependency to a gitbook?
The goal is to provide an easy way to add a corporate css (including images). The definition of the htmlDependency()
and all the required files would reside in an R package.
回答1:
The ...
arguments of bookdown::gitbook()
are eventually passed to rmarkdown::html_document()
, which are further passed to rmarkdown::html_document_base()
, which has an extra_dependencies
argument. You can create your list of dependencies with htmltools::htmlDependency()
, and pass them to bookdown::gitbook()
via the extra_dependencies
argument.
来源:https://stackoverflow.com/questions/50657295/how-to-add-a-custom-htmldependency-in-bookdowngitbook