Continued issues with new {verbatim} in RStudio

The {verbatim} syntax seems to work properly in R, but I think it breaks RStudio's code chunk coloring and folding.

Notice how line 587 is not part of the gray block and colors the next text line incorrectly. The Rmd file renders just fine with no errors into a PDF using bookdown. It just seems like RStudio is not displaying it correctly.

If I leave out line 587 (````), I get a mismatched tic warning when building the book, and the tics shown on line 586 do not show up in the PDF file.

Is there something I'm doing wrong here? Is there a better way to do this?

Yes this is a known issue with the IDE

You can put a :+1: there to show that this is indeed annoying... :sweat:

In this case, you can put the content of the chunk in another R Markdown file, and then use the embed engine to include it as verbatim content. The markdown source won't be messed up.

```{embed, file = "my-file.Rmd"}
```

This will add the content of the Rmd file as a verbatim content highlighted as Markdown source

Thanks for the quick answer and the alternative approach. I put the :+1: on github - since it is, indeed annoying.

1 Like

This topic was automatically closed 7 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.