How create verbatim environments within learnr tutorials?

It is easy to create verbatim environments within regular R markdown documents. Example:

````{verbatim}
```{r}

```
````

In the knitted document, only the material within the quadruple backticks is displayed. We see:

```{r}

```

However, this same trick fails when used within a learnr tutorial, even though it is also an R markdown document. Nothing is displayed. I suspect that this has something to do with the use of Shiny to display learnr tutorials.

How can I use a verbatim environment within learnr tutorials, or something similar?

Hi @dkane, that sounds a lot like a bug! Or, at least, I can’t think of a reason off the top of my head why it wouldn’t work as you rightly expect in learnr. I’m on vacation this week, but if you don’t mind opening an issue in the learnr repo, I’ll be happy to take a look next week.

Thanks. Done! Enjoy your vacation.

My mistake! Turns out that I just needed to set echo = TRUE.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.