Open gadenbuie opened 2 years ago
When exercise.eval = FALSE
:
eval = FALSE
and echo = FALSE
were added to the chunkeval = TRUE
is set on the chunk, evaluate the setup chunk in prerender alsoecho = TRUE
is set on the chunk, pre-render uses echo = TRUE, include = <chunk_setting> %||% TRUE
so that the chunk is echoed and output is shown in the static content.When exercise.eval = TRUE
, do the same as the above, but ensure that the chunk is evaluated as if it had eval = TRUE
.
When an exercise is pre-evaluated with
exercise.eval = TRUE
, the setup chunks are all evaluated as well and the output is shown. Butecho=FALSE
is enforced on the setup chunk, so it's not possible to override this behavior.Reprex
```` --- title: "Tutorial" output: learnr::tutorial runtime: shiny_prerendered --- ```{r setup, include=FALSE} library(learnr) ``` ## Topic 1 ```{r two-plus-two-setup, echo=TRUE} x <- 2 x ``` ```{r two-plus-two, exercise=TRUE, exercise.eval = TRUE} x + 2 ``` ````I see two options for when
exercise.eval=TRUE
:echo=TRUE
orinclude=FALSE
on the setup chunk be used.I like the second option best as it's most consistent with our other modes.
OTOH, the first option can be used as a way to have setup chunks appear in both the exercise and the pre-rendered tutorial, rather than using
ref.label
or other chunk-repeating techniques. I'm less excited about this option since it requires pre-evaluating the exercise code, which may contain errors or be incomplete, and it's a rather large side-effect to result from setting theexercise.eval
chunk option.