how to add a custom htmlDependency in `bookdown::gitbook`

流过昼夜 提交于 2020-01-15 04:55:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!