Skip to content
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

Default highlighting color change (no specific highlighting pandoc statement in yaml) #2044

Open
3 tasks done
garberadamc opened this issue Feb 11, 2021 · 2 comments
Open
3 tasks done
Labels
theme: highlight theme: pandoc concerns upstream pandoc

Comments

@garberadamc
Copy link

After updating Rstudio (Version 1.4.1103) & re-knitting my RMD file the default syntax highlighting changed. I did not specify any statements in the YAML (i.e., default/automatic highlighting). I would like to reproduce the original style (highlighting color was orange rather than yellow). I tried all the yaml options found in Garrick's blog but could not reproduce this style. To see the change in highlighting style see the before and after screenshots here.

  • Here is the github repository which contains the rmarkdown file after the highlighting changes.

By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('rmarkdown'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/rmarkdown').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

@cderv
Copy link
Collaborator

cderv commented Feb 11, 2021

Hi @garberadamc Thanks for opening the issue. It is very clear and the link to your repo helped a lot.

I believe the change you see is due to a change in Pandoc version. RStudio 1.3 came by default with Pandoc 2.7.3 and RStudio 1.4 comes with Pandoc 2.11.2.

As you are using PDF, the default highlighting style is tango from Pandoc Syntax Highlighting. This means that is Pandoc doing the code parsing for syntax highlighting, and set the style to tango in this case. It seems they have changed the parsing and maybe also the style.

See this question in the community where I also explain this for HTML : https://community.rstudio.com/t/was-pygments-highlight-style-in-html-output-changed-in-rstudio-1-4/89925/2

One quick way of keeping the old style for your document is to use the old pandoc. See
https://bookdown.org/yihui/rmarkdown-cookbook/install-pandoc.html

This is also a way to pin a specific Pandoc version within a document. You won't have access to bug fix and new Pandoc features, but this is the same as when you are pinning some R packages.

There would be another solution which is to export old style from Pandoc 2.7.3 and apply on the new Pandoc, but currently this is not easy with rmarkdown or other tool - we'll work on that. (Related to #2035)

Is it helping understanding the why ?

Thank you for your patience while we try to find the proper solution to avoid such thing in the future.

@cderv cderv added the theme: pandoc concerns upstream pandoc label Feb 11, 2021
@ycl6
Copy link

ycl6 commented Mar 5, 2021

@garberadamc I also found out about this bug today. It happens to me when the pandoc version is 2.11.2 and 2.11.4 (latest).
I remember it was fine sometime last year, so I tried the 2.10.1 (updated ~7 months ago) and the syntax highlight is now back to as before. I use conda, so it is quite easy to switch between different pandoc versions, you can give it a go.

edit: I set this gallery up to show the differences in the syntax highlightings before and after v2.11 for all supported styles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: highlight theme: pandoc concerns upstream pandoc
Projects
None yet
Development

No branches or pull requests

3 participants