问题描述
bookdown::gitbook()
添加 https://github的内容. com/rstudio/bookdown/tree/master/inst/resources/gitbook 作为htmltools::htmlDependency
.如何将这样的自定义依赖项添加到gitbook?
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?
目标是提供一种添加公司CSS(包括图像)的简便方法. htmlDependency()
的定义和所有必需的文件将位于R包中.
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.
推荐答案
bookdown::gitbook()
的...
参数最终传递给rmarkdown::html_document()
,然后进一步传递给具有extra_dependencies
参数的rmarkdown::html_document_base()
.您可以使用htmltools::htmlDependency()
创建依赖项列表,然后通过extra_dependencies
参数将其传递给bookdown::gitbook()
.
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.
这篇关于如何在bookdown :: gitbook中添加自定义htmlDependency的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!