demoR icon indicating copy to clipboard operation
demoR copied to clipboard

Demo for chunks or inline expressions

Open emitanaka opened this issue 5 years ago • 2 comments

It feels like this package will be a good place to have a function to have demo for chunks or inline expressions.

E.g. if I want to write

```{r}
summary(cars)
```'

(removing ' at the end) then it would render as:

summary(cars)

Similar with inline expression r mean(cars$dist) where there is a bit of an effort needed to show "`".

I've implemented some work around before but I always forget. I would feel that it would sit nicely with this package if you are interested!

emitanaka avatar Jul 29 '19 10:07 emitanaka

Hi @emitanaka,

I'm not 100% sure I understand. Do you mean shortcuts for showing the chunk source code itself? For purposes of teaching how to use markdown and chunks?

For example, something like:

```{r plot, echo = TRUE, eval = FALSE}
plot(1:10)
```
```{r}
demo_markdown("plot")
```

would render as

```{r plot, echo = TRUE, eval = FALSE}
plot(1:10)
```

If this is what you mean, I think it would fit very nicely with demoR. Thank you for the idea! I'll see what I can do.

kbodwin avatar Jul 29 '19 22:07 kbodwin

Yes that's what I mean! Thanks for considering it :)

emitanaka avatar Jul 31 '19 23:07 emitanaka