1

I am compiling a vignette for my R package and I want to preserve the .md output too. I believe I should be able to do this with keep_md: TRUE, but this doesn't appear to work. MWE below, which doesn't produce a .md file when I run devtools::build_vignettes().

The vignette:

    ---
    title: "mwe"
    output:
        rmarkdown::html_vignette:
            keep_md: TRUE
    vignette: >
      %\VignetteIndexEntry{mwe}
      %\VignetteEngine{knitr::rmarkdown}
      %\VignetteEncoding{UTF-8}
    ---
    
    ```{r, include = FALSE}
    knitr::opts_chunk$set(
      collapse = TRUE,
      comment = "#>"
    )
    ```
    
    ```{r setup}
    library(foo)
    
    print("This is my vignette. I want to keep the .md file.")
    ```

Resulting file structure (i.e. no .md file):

    .
    ├── .Rbuildignore
    ├── .gitignore
    ├── DESCRIPTION
    ├── Meta
    │   └── vignette.rds
    ├── NAMESPACE
    ├── R
    ├── doc
    │   ├── mwe.R
    │   ├── mwe.Rmd
    │   └── mwe.html
    └── vignettes
        ├── .gitignore
        └── mwe.Rmd

Am I specifying the keep_md option correctly?

DyedPurple
  • 56
  • 5
  • 1
    There is an unsolved issue about it: https://github.com/r-lib/devtools/issues/2156. Try to do it manually: https://stackoverflow.com/questions/45575971/compile-a-vignette-using-devtoolsbuild-vignette-so-that-md-is-kept-in-the-v – Clemsang Apr 25 '23 at 14:19
  • Thank you, sorry for missing these links before. For some reason, they didn't come up when I searched... I guess I was hoping that there was a problem in my code, but it sounds like I just need to use this workaround instead. Thanks! – DyedPurple Apr 25 '23 at 19:33

0 Answers0