Extract code chunks from R Markdown or Quarto file
Examples
extract_code("https://raw.githubusercontent.com/JeffreyRStevens/flashr/refs/heads/main/README.Rmd")
#> [1] "knitr::opts_chunk$set("
#> [2] " collapse = TRUE,"
#> [3] " comment = \"#>\","
#> [4] " fig.path = \"man/figures/README-\","
#> [5] " out.width = \"100%\""
#> [6] ")"
#> [7] "install.packages(\"flashr\")"
#> [8] "# install.packages(\"remotes\")"
#> [9] "remotes::install_github(\"JeffreyRStevens/flashr\")"
#> [10] "library(flashr)"
#> [11] "flashcard(\"data_types\")"
#> [12] "flashcard(\"data_types\", termsfirst = FALSE)"
#> [13] "my_deck <- read.csv(\"inst/extdata/operators.csv\")"
#> [14] "head(my_deck)"
#> [15] "flashcard(\"inst/extdata/operators.csv\")"