How to create custom blocks in RMarkdown?

Viewed 682

In RMarkdown, I know I can type something like this:

```{r}
sum <- 1 + 1
```

To create a block to be evaluated inside the R session for the currently processed .Rmd document. I know there are others where the label inside {<label>} changes and triggers a different behavior. Fx, [Bookdown]{https://bookdown.org/yihui/bookdown/markdown-extensions-by-bookdown.html#equations} defines: {theorem} and others.

What I need

I wanna be able to create my own block and execute certain code to handle its content:

```{myblock}
This text will appear styled different (for example)
```

I do not need to create a new block for styling text, the one above is just an example. How can I achieve this customization?

1 Answers
Related