Build .md vignette using devtools

ε祈祈猫儿з 提交于 2019-12-10 14:22:42

问题


I’m using knitr::rmarkdown (but knitr::knitr does the same) as my VignetteEngine. I then build my package vignette using devtools::build_vignettes().

This works, but only creates HTML and R output files in inst/doc. What I want is a Markdown output file, since only that can be displayed directly within the Github project pages (for HTML files, Github shows the source and for Rmd files it shows a rendered output but — obviously — without executing the R blocks).

I’ve tried finding out how to specify the output for custom VignetteEngines and I think that it should be possible (after all, other packages use this to build PDF vignettes, at a minimum) but I cannot find a way of doing this via devtools::build_vignettes. Is there no way around building the vignette manually (i.e. via knitr::knit or similar mechanisms that ignore the VignetteBuilder directives)?

I can’t find relevant information in the documentation/source either.


回答1:


The only output formats for vignettes are HTML and PDF (and LaTeX, but it is converted to PDF, not displayed). Markdown isn't supported.

You can have arbitrary documentation files in your package (by convention you put them in inst/doc), but they aren't considered to be vignettes, so they won't be automatically built, functions like browseVignettes() will ignore them, etc.

To convert an Rmd file to md, just run knitr::knit on it.



来源:https://stackoverflow.com/questions/44356236/build-md-vignette-using-devtools

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