Here is an example
tmp <- tempfile(fileext = ".md")
md <- "---
title: DuckDB, `{DBI}`, `data.frame`s, and `{dplyr}`.
---
<!--
# Outline:
- DuckDB and DBI basics
- database driver objects `duckdb::duckdb()`
- database connection object
- creating tables from dataframes
- executing plain SQL queries
- using duckdb with dplyr
- copying tables over
- creating a tbl connection
- basics on lazy eval point to dplyr for production
- `show_query()`
- in the next section we'll go over how to bring these results into memory and different strategies
- to collect(), compute(), or wait.
- bring the results into R directly
- `collect()` is recommeneded but `as_tibble()` or `as.data.frame()` will work just as well
- store our statements by assinging objects. this generates the sql but does not do any execution
- we can combine these objects together e.g. subqueries and joins
-->
"
brio::write_file(md, tmp)
lightparser::split_to_tbl(tmp)
#> It seems you are currently knitting a Rmd/Qmd file. The parsing of the file will be done in a new R session.
#> # A tibble: 4 × 8
#> type label params text code heading heading_level section
#> <chr> <lgl> <list> <named lis> <lis> <chr> <dbl> <chr>
#> 1 yaml NA <named list [1]> <lgl [1]> <lgl> <NA> NA <NA>
#> 2 inline NA <lgl [1]> <chr [3]> <lgl> <NA> NA <NA>
#> 3 heading NA <lgl [1]> <chr [1]> <lgl> "Outli… 1 "Outli…
#> 4 inline NA <lgl [1]> <chr [19]> <lgl> <NA> NA "Outli…
Created on 2024-05-25 with reprex v2.1.0
Here is an example
Created on 2024-05-25 with reprex v2.1.0