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

Verbatim code chunks #17

Open
gadenbuie opened this issue Jun 19, 2019 · 3 comments
Open

Verbatim code chunks #17

gadenbuie opened this issue Jun 19, 2019 · 3 comments

Comments

@gadenbuie
Copy link

Hi @njtierney! So I was just browsing your blog's source code (you know, like a normal person) and noticed this great post wasn't showing verbatim R code chunks

image

In your rmarkdown code chunk, this thing
````
```{r}
```
````

To fix this, you need to add this thing (lets call it an inline R noop and save me 8 backticks)

`r ''`

to the end of the R chunk header line, i.e.

````
```{r title}`r ''`
```
````

The inline R noop breaks knitr's chunk parser so that the three+ backticked r chunk doesn't get evaluated by knitr. As always, Yihui has a blog post about it here.

@gadenbuie
Copy link
Author

Btw -- and I really hope you don't mind the intrusion -- but while I was here I noticed you have a notes on teaching draft post that is just fantastic. I have lots of outline-style posts kicking around in my head/repo/etc. where I haven't removed that draft: true and if you'll also permit me to suggest advice I wish I would listen to myself: just put it out there! Seriously. Just add a couple links where they're missing, remove or complete the few unfinished sentences, and hit publish. It doesn't need to be in paragraph form to be superbly helpful!

@njtierney
Copy link
Collaborator

Heya @gadenbuie ! :)

Thanks for your kind words and feedback!

Re the backtick escape - I could not remember this trick, although I knew it existed, I find I often forget about it, and what it is, exactly. I feel like there should be an rstudio addin for this, because showing an rmarkdown chunk as is is actually a pretty common teaching case. I've actually just lodged this as an issue on the remedy package.

@njtierney
Copy link
Collaborator

And double thanks for your kind comment about my teaching draft post :)

The thing is - I don't even remember writing it! I think it contains a bunch of notes from when I went through the software carpentry teaching training, from this awesome book, How learning works, and then from this talk I gave: "Rethinking teaching statistical computing"

I'll make an effort to dust off that post, and get it online, thank you so much for the push 😄

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

2 participants