Introduction

The Pandoc syntax highlighting changed in version 2.11 when showing R Markdown. Below I show viewers comparisons before and after version 2.11.

Supported styles

pandoc --list-highlight-styles
## pygments
## tango
## espresso
## zenburn
## kate
## monochrome
## breezedark
## haddock

Example code

pandoc -v | head -n 2
# The easiest way to get ggplot2 is to install the whole tidyverse:
install.packages("tidyverse")

# Alternatively, install just ggplot2:
install.packages("ggplot2")

# Or the development version from GitHub:
devtools::install_github("tidyverse/ggplot2")

library(ggplot2)

ggplot(mpg, aes(displ, hwy, colour = class)) +
        geom_point(size = 3, alpha = 1/10)

Session information

sessionInfo()
## R version 4.0.3 (2020-10-10)
## Platform: x86_64-conda-linux-gnu (64-bit)
## Running under: Ubuntu 18.04.5 LTS
## 
## Matrix products: default
## BLAS/LAPACK: /home/ihsuan/miniconda3/envs/r4/lib/libopenblasp-r0.3.12.so
## 
## locale:
##  [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8       
##  [4] LC_COLLATE=en_GB.UTF-8     LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8   
##  [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
## [10] LC_TELEPHONE=C             LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] knitr_1.31
## 
## loaded via a namespace (and not attached):
##  [1] digest_0.6.27     R6_2.5.0          jsonlite_1.7.2    magrittr_2.0.1   
##  [5] evaluate_0.14     highr_0.8         rlang_0.4.10      stringi_1.5.3    
##  [9] jquerylib_0.1.3   bslib_0.2.4       rmarkdown_2.7     tools_4.0.3      
## [13] stringr_1.4.0     xfun_0.21         yaml_2.2.1        compiler_4.0.3   
## [17] htmltools_0.5.1.1 sass_0.3.1