Open NuoWenLei opened 2 years ago
I am aware of this parsing issue and I haven't come up with a satisfactory solution as of yet. I may be able to add a specific parsing rule just for this case but I find this specific syntax a bit hacky (but I completely understand the use case) which is why I have not specifically added it as of yet.
I see, thank you for the quick reply. I am currently just using images of the code chunks and I think that is a completely fine workaround, so at least for me this is not an urgent issue.
You can also try Hadley's method mentioned in knitr-example 65 https://github.com/yihui/knitr-examples/blob/master/065-rmd-chunk.Rmd which uses a zero-width space in the chunk header to prevent it from parsing as code.
ok thank you!
As a frequent user of the `r ''`
pattern I'd really appreciate a specific parsing rule for this use case.
```{r eval=TRUE}`r ''`
n = 10
rnorm(x)
That approach to adding literal code chunks, as well as putting the `` `r ''` `` at the start of the line, has been [widely advertised for a while](https://yihui.org/en/2017/11/knitr-verbatim-code-chunk/). I agree it's a hacky approach, but personally I find it preferable to using a zero-width space (difficult to write, impossible to see).
Does the introduction of verbatim chunks (knitr 1.37) save us from this? Like, can you just say that that verbatim chunks are the preferred approach (probably in general) and especially if you want to use parsermd?
https://bookdown.org/yihui/rmarkdown-cookbook/verbatim-code-chunks.html
Function
parsermd::parse_rmd()
returns an error when parsing Rmd documents that use the `r ''` trick anywhere in the document.I got this trick from bookdown's rmd cookbook. It's a way of showing verbatim chunks in knitted documents.
Are there any work-arounds? Or is this an intended result?
Rmd snippet:
Knitr output:
Error when ran with parse_rmd():
Thank you, Nuo Wen Lei