Bioconductor / BiocStyle

Issues and pull requests for BiocStyle should go here.
12 stars 19 forks source link

Addition of two new functions #70

Closed Kayla-Morrell closed 4 years ago

Kayla-Morrell commented 4 years ago

When these functions are called, a vignette file will be created that contains the skeleton for the vignette. These skeletons come from the templates within BiocStyle. It is the hope that these functions will help limit the number of wrongly formatted vignette files, mostly having to do with the metadata information.

aoles commented 4 years ago

Nice work, thank you for your contribution!

These additions seem to be similar to the functionality already provided by rmarkdown draft function. In fact, the following results in the same file as a call to use_vignette_rmd("MyVignette").

rmarkdown::draft("MyVignette.Rmd", template = "html_document", package = "BiocStyle")

Therefore, I would rather refrain from duplicating existing functionality. Instead, how about looking into improving the documentation to point to the use of draft and the R Markdown templates menu from RStudio's GUI as entry points for creating new vignettes?

image

If there is still need of providing additional shortcut functions I would recommend implementing them as simple wrappers to rmarkdown::draft named as draft_html_vignette and draft_pdf_vignette. The label vignette_rmd might be somehow confusing as Rmd is the input for both HTML and PDF vignettes. Typically one can produce either format from the same Rmd source file by simply changing output in the YAML header.

Cheers, Andrzej

mtmorgan commented 4 years ago

Personally I like the idea of something like BiocStyle::use_vignette_rmd() --- I know about the RStudio template but don't use RStudio; I'm also familiar, from use devtools etc., with usethis::use_vignette(). I would never have been able to come up with the rmarkdown::draft() solution, and would always have to look up the documentation instead of just using it...

aoles commented 4 years ago

Thanks for your feedback @mtmorgan ! I agree that there is certain value in use_vignette()-type convenience functions. On the technical side I strongly advise to implement these functions on top of the functionality offered by rmarkdown. The reason behind this is simplicity and robustness: rmarkdown::draft copies not only the bare Rmd skeleton but any supporting files too such as graphics etc. As already pointed out, be careful with the names - I'm still not sure whether BiocStyle::use_vignette_rmd() is the optimal choice..

aoles commented 4 years ago

Perfect, thanks again for your contribution!