本文介绍了如何在bookdown :: gitbook中添加自定义htmlDependency的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 22:11