Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: rmarkdown verbatim chunk / inline #61

Open
njtierney opened this issue Jun 20, 2019 · 2 comments
Open

Feature request: rmarkdown verbatim chunk / inline #61

njtierney opened this issue Jun 20, 2019 · 2 comments

Comments

@njtierney
Copy link

I'm frustrated when I want to show an rmarkdown chunk inside a rmarkdown document - in github, you can use four backticks and get the following:

```{r chunk-name, fig.align = "center"}
```

But this does not work for rmarkdown - @gadenbuie recently kindly reminded me of the trick from Yihui on how to shoe a verbatim chode chunk or inline E Expression

Describe the solution you'd like
I'd love for verbatim to have two options:

  • "Show verbatim code chunk", and
  • "Show verbatim inline R expression"

Describe alternatives you've considered

At the moment the alternative is for me to remember this in my head, which I don't, and I find it hard to have a clear conceptual framework to remember that

`r ''`

will break knitr's chunk parser and allow me to show the thing I want.

Additional context

I think that's about it - just, in general, thanks for writing this super nifty package!

@njtierney njtierney changed the title Feature request: Feature request: rmarkdown verbatim chunk / inline Jun 20, 2019
@yonicd
Copy link
Collaborator

yonicd commented Jan 12, 2020

I have recently tried this in {details} and {texPreview} and it seems to not be compatible with something in RStudio IDE. The play icon disappears in chunks that come after the four tick chunk, until I put in another four tick chunk.

image

and then when trying to run the chunk without a play icon I get an error in the output console

Error: attempt to use zero-length variable name
> knitr::kable(head(iris),format = 'latex',booktabs = TRUE)

\begin{tabular}{rrrrl}
\toprule
Sepal.Length & Sepal.Width & Petal.Length & Petal.Width & Species\\
\midrule
5.1 & 3.5 & 1.4 & 0.2 & setosa\\
4.9 & 3.0 & 1.4 & 0.2 & setosa\\
4.7 & 3.2 & 1.3 & 0.2 & setosa\\
4.6 & 3.1 & 1.5 & 0.2 & setosa\\
5.0 & 3.6 & 1.4 & 0.2 & setosa\\
\addlinespace
5.4 & 3.9 & 1.7 & 0.4 & setosa\\
\bottomrule
\end{tabular}
> ```
Error: attempt to use zero-length variable name

@cderv
Copy link

cderv commented Nov 17, 2021

FYI current dev version of knitr introduces a new verbatim engine to facilitate this

Writing this (mind the number of bacticks to nest chunks)

````{verbatim, lang = "markdown"}
```{r chunk-name, fig.align = "center"}
```
````

will produce

````markdown
```{r chunk-name, fig.align = "center"}
```
````

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants