yihui / knitr

A general-purpose tool for dynamic report generation in R
https://yihui.org/knitr/
2.37k stars 874 forks source link

Don't fallback to parse usual R comments in Quarto #2225

Open cderv opened 1 year ago

cderv commented 1 year ago

This is related to discussion in https://github.com/quarto-dev/quarto-cli/issues/4306

Making this draft PR to test a scenario and discuss. This is WIP

Regarding second commit, if we don't error but just don't fallback we would get this behavior with an obscure error due to in chunk content not being parsed as option

---
title: "Example"
format: html
engine: knitr
---

```{r}
# install.packages(c("DBI", "RSQLite"))
db = DBI::dbConnect(RSQLite::SQLite(), ":memory:")
#| label: test multiqueries -5
#|  connection: db

select 1

processing file: test2.qmd |.......................................... | 80% (unnamed-chunk-2)Quitting from lines 14-18 (test2.qmd) Error: ! The 'connection' option (DBI connection) is required for sql chunks. Backtrace:

  1. global .main()
  2. execute(...)
  3. rmarkdown::render(...)
  4. knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
  5. knitr:::process_file(text, output)
  6. knitr:::process_group.block(group)
  7. knitr:::call_block(x)
    1. knitr:::block_exec(params)
    2. knitr (local) engine(options)
    3. knitr:::stop2("The 'connection' option (DBI connection) is required for sql chunks.") Exécution arrêtée