简体   繁体   English

如何在bookdown :: gitbook中添加自定义htmlDependency

[英]how to add a custom htmlDependency in `bookdown::gitbook`

bookdown::gitbook() adds the content of https://github.com/rstudio/bookdown/tree/master/inst/resources/gitbook as a htmltools::htmlDependency . bookdown::gitbook()https://github.com/rstudio/bookdown/tree/master/inst/resources/gitbook的内容添加为htmltools::htmlDependency How can I add such a custom dependency to a gitbook? 如何将这样的自定义依赖项添加到gitbook?

The goal is to provide an easy way to add a corporate css (including images). 目的是提供一种添加公司CSS(包括图像)的简便方法。 The definition of the htmlDependency() and all the required files would reside in an R package. htmlDependency()和所有必需文件的定义将驻留在R包中。

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. bookdown::gitbook()...参数最终传递给rmarkdown::html_document() ,后者进一步传递给rmarkdown::html_document_base() ,后者具有extra_dependencies参数。 You can create your list of dependencies with htmltools::htmlDependency() , and pass them to bookdown::gitbook() via the extra_dependencies argument. 您可以使用htmltools::htmlDependency()创建依赖项列表,然后通过extra_dependencies参数将其传递给bookdown::gitbook()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM