Converts ‘Rd’ to Quarto files

R/rd-to-qmd.R

rd_to_qmd

Description

Converts ‘Rd’ to Quarto files

Usage

rd_to_qmd(
  path,
  pkg = ".",
  examples = TRUE,
  not_run_examples = FALSE,
  template = NULL,
  quarto_file_path = NULL
)

Arguments

Arguments Description
path The path to the source Rd file
pkg Path to the root of the R package. Defaults to ".".
examples Flag that sets the examples code chunk to be evaluated when the Quarto document is rendered
not_run_examples Flag that sets the “do not run” examples code chunk to be evaluated when the Quarto document is rendered
template The path to a Quarto file that can be used as the template for all of the resulting reference files. If left NULL, pkgsite will use its default template.
quarto_file_path Path to the folder containing _quarto.yml. Use when the Quarto project root differs from the package root (e.g. the package lives in a sub-folder of a larger Quarto project). Must be a directory path. Defaults to NULL, in which case pkg is used.

Value

A character vector with the resulting contents of converting the Rd file format into a Quarto file format.

Examples

library(pkgsite)
example_pkg <- system.file("example", package = "pkgsite")
rd_to_qmd(file.path(example_pkg, "man", "rd_to_qmd.Rd"), pkg = example_pkg)
#>  [1] "---"                                                                                                                                                                       
#>  [2] "title: \"Converts 'Rd' to Quarto files\""                                                                                                                                  
#>  [3] "execute:"                                                                                                                                                                  
#>  [4] "  eval: true"                                                                                                                                                              
#>  [5] "  freeze: true"                                                                                                                                                            
#>  [6] "---"                                                                                                                                                                       
#>  [7] ""                                                                                                                                                                          
#>  [8] "## rd_to_qmd"                                                                                                                                                              
#>  [9] ""                                                                                                                                                                          
#> [10] "## Description"                                                                                                                                                            
#> [11] "Converts 'Rd' to Quarto files"                                                                                                                                             
#> [12] ""                                                                                                                                                                          
#> [13] ""                                                                                                                                                                          
#> [14] "## Usage"                                                                                                                                                                  
#> [15] "```r"                                                                                                                                                                      
#> [16] "rd_to_qmd("                                                                                                                                                                
#> [17] "  rd_file,"                                                                                                                                                                
#> [18] "  project = \".\","                                                                                                                                                        
#> [19] "  pkg = NULL,"                                                                                                                                                             
#> [20] "  examples = TRUE,"                                                                                                                                                        
#> [21] "  not_run_examples = FALSE,"                                                                                                                                               
#> [22] "  template = NULL"                                                                                                                                                         
#> [23] ")"                                                                                                                                                                         
#> [24] "```"                                                                                                                                                                       
#> [25] ""                                                                                                                                                                          
#> [26] "## Arguments"                                                                                                                                                              
#> [27] "|Arguments|Description|"                                                                                                                                                   
#> [28] "|---|---|"                                                                                                                                                                 
#> [29] "| rd_file | The name of the source Rd file |"                                                                                                                              
#> [30] "| project | The path to the root folder of the project. |"                                                                                                                 
#> [31] "| pkg | The path inside the project folder. Use only if the R package itself is in a sub-folder within the project. |"                                                     
#> [32] "| examples | Flag that sets the examples code chunk to be evaluated when the Quarto document is rendered |"                                                                
#> [33] "| not_run_examples | Flag that sets the \"do not run\" examples code chunk to be evaluated when the Quarto document is rendered |"                                         
#> [34] "| template | The path to a Quarto file that can be used as the template for all of the resulting reference files. If left NULL, `pkgsite` will use its default template. |"
#> [35] ""                                                                                                                                                                          
#> [36] ""                                                                                                                                                                          
#> [37] "## Value"                                                                                                                                                                  
#> [38] "A character vector with the resulting contents of converting the Rd file format into a Quarto file format."                                                                
#> [39] ""                                                                                                                                                                          
#> [40] ""                                                                                                                                                                          
#> [41] ""                                                                                                                                                                          
#> [42] ""                                                                                                                                                                          
#> [43] ""                                                                                                                                                                          
#> [44] "## See Also"                                                                                                                                                               
#> [45] "Other Conversion functions: `index_to_qmd()`, `rd_to_list()`"                                                                                                              
#> [46] ""                                                                                                                                                                          
#> [47] "## Examples"                                                                                                                                                               
#> [48] "```r"                                                                                                                                                                      
#> [49] "library(pkgsite)\nrd_to_qmd(\"rd_to_qmd.Rd\", project = \".\")"                                                                                                            
#> [50] "```"

See Also

Other Conversion functions: index_to_qmd(), rd_to_list()