Should code-line-numbers be optionally hidden on echo: fenced? #3554
jthomasmock
started this conversation in
Feature Requests
Replies: 1 comment 3 replies
-
Getting back on this, as things might have a little bit changed. Currently, ---
title: "Quarto Playground"
format:
revealjs: default
html:
code-line-numbers: true
---
## This is a playground for Quarto.
```{r}
#| echo: fenced
x <- 0
x + 1
```
```{r}
#| echo: fenced
#| code-line-numbers: false
#| code-fold: false
x <- 0
x + 1
```
A workaround is to define a function (possibly as a knitr hook for easier use, https://bookdown.org/yihui/rmarkdown-cookbook/output-hooks.html): ---
title: "Quarto Playground"
format:
revealjs: default
html:
code-line-numbers: true
---
```{r}
#| include: false
echo_fenced <- function(txt) {
knitr::asis_output(paste(
c(
"````", "```{r}", txt, "```", "````",
knitr::knit_child(text = knitr::knit_expand(text = c("```{r}", txt, "```")), quiet = TRUE)
),
collapse = "\n"
))
}
```
## This is a playground for Quarto.
```{r}
echo_fenced("#| code-fold: false
x <- 0
x + 1")
``` |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When teaching I often use the amazing
#| code-line-numbers:
+echo: fenced
to step through code as well as focused chunk options.It's awkward to need to address code-line-numbers with learners as it's very seldom appropriate for the current lesson to ALSO cover the
code-line-numbers
option specifically for presentations as opposed to more general topics that are being shown.Would it make sense to optionally turn off code-line-numbers showing up with
echo: fenced
? Or is there an optimal way to avoid showing that chunk option today?Beta Was this translation helpful? Give feedback.
All reactions