source_verbatim: Print verbatim code chunks

Description Usage Details Examples

View source: R/hooks.R

Description

View the code chunk "asis" along with the chunk output.

Usage

1

Details

To run this hook, call the source_verbatim() function and then you can either print all source code as verbatim chunks

knitr::opts_chunk$set(source_verbatim = TRUE)

or you can print it on a chunk by chunk basis

1
2
3
```{r source_verbatim = TRUE}
print(mtcars)
```

If you would like to only print the source code as verbatim and not have the code evaluated, use eval = FALSE, i.e.

1
2
3
```{r, eval = FALSE, source_verbatim = TRUE}
print(mtcars)
```

The resulting output will look like this.

1
2
3
```{r}
print(mtcars)
```

Examples

1

nathaneastwood/knitrhooks documentation built on May 4, 2019, 3:18 p.m.