Was the pygments highlight style in HTML output of Rmd documents changed in RStudio 1.4? Or is it a bug? What is this discrepancy caused by? (Find the details below.)
System details
RStudio Edition : Desktop
RStudio Version : 1.4.1075
OS Version : Windows 10
R Version : 4.0.3
Steps to reproduce the problem
Create any Rmd document with R code included and highlight style pygments enabled.
The only thing I changed is the version of RStudio. I reinstalled different versions several times and I still can reproduce the issue in 1.4. I did not check the other styles. This source also demonstrates the pygments style that is used in RStudio 1.3.
You encounter this behavior because the syntax highlighter in Pandoc has updated its syntax definition for the R language in Pandoc 2.11. That means the R code is not parsed the same by the highlighter - usually an update of the engine means better parsing - and even if the underlying color have not changed, they do not apply the same as the parsing was different. For example, set is now see as a function so it has correctly a different color than TRUE which is a logical condition token.
I won't go more into details about how syntax highlighing engine works here. But that is the reason.
You get this by switching RStudio version because RStudio 1.4 now ship with Pandoc 2.11+ and RStudio 1.3 ships with Pandoc 2.7.3.
Rmarkdown and RStudio are just using the Pandoc version associated with it, they do not do anything regarding syntax highlighting on this one. It is all Pandoc.
If for some reason you would like to have the previous colors (which where applied with a less good parser), you'll need to export the theme file from Panod 2.7.3, and use it with Pandoc 2.11