-
-
Notifications
You must be signed in to change notification settings - Fork 879
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
R Markdown in tab indented code block raises duplicated label error #443
Comments
Yes. I believe it was modified in 0.80. @yihui has an example showing how to use hooks to print a code chunk verbatim especially useful in tutorials https://github.com/yihui/knitr-examples/blob/master/062-chunk-wrapper.Rmd |
Here is the relevant change from
|
Thanks for that. The behaviour certainly surprised me, but I suppose it only really affects people writing R Markdown tutorials. And as you say, there are alternatives. |
The easiest solution is to destroy the code chunk by adding an empty string to the chunk header:
This is what I use when writing tutorials. Sorry for the trouble, but I think it makes sense to allow indented code blocks. |
@yihui Apologies for reviving a dead issue, but is there a similar trick for displaying the source for an inline r computation, i.e.
? |
@jmarshallnz Yes, the simplest solution is to insert a zero-width space between the first backtick and the little r. A slightly more trickier solution:
|
Thanks - that does the trick :) |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary. |
I have a tutorial where R Markdown code blocks are displayed as formatted code blocks. I was using knitr 0.8 and the same problem seems to occur after updating to version 0.9.
Here is a minimal example
This yields the following error:
I assume that the parser is not realising that R markdown in code blocks is not a real R Markdown code block . When I originally wrote the tutorial, I didn't have this problem.
Update: I just noticed when I updated the code blocks to remove the labels, that tab indented code blocks are run as regular R code chunks. Is this just the new intended behaviour of knitr that R code chunks don't have to start and end at the start of a new line?
The text was updated successfully, but these errors were encountered: