I am composing blog articles in plain Markdown (i.e. .md
files, but the same applies for R Markdown or .Rmd
) and have noticed that the RStudio editor will add syntax highlighting for every kind of code block except R.
That is, a fenced block with ```scala (for example) at the start will have syntax highlighting in the editor. But a chunk with ```r will have no highlighting at all, as if I did not add a language prefix at all and was just writing a plain fenced code block.
I have looked all through the documentation and can't find any explanation for this. If any language was meant to be supported, I would expect it to be R.
The behaviour is the same whether I am writing an .Rmd
or a .md
but it only applies to non-evaluated fenced blocks (the ones without the curly brackets, i.e. not functionally evaluated chunks like ```{r}, ```{python}).
Screenshot in case my explanation was unclear: