Vignette syntax highligting in help viewer

I recently rebuilt the [HTML] vignette in my package passport. When I looked at the vignette in RStudio's help viewer, the syntax highlighting had gone terribly wrong:

The weird part, though, is that if I click on the "Show in new window" button or open the vignette in a browser, it appears with a light background and looks fine:

and other packages vignettes look fine in the help pane, e.g. dplyr::dplyr:

...so as far as I can tell, the issue seems to originate in the combination of the CSS that RStudio applies to vignettes as part of the dark theme and the HTML classes produced by rmarkdown::html_vignette.

I updated all the relevant packages to development versions, and RStudio to the preview build (1.1.442) to no avail. Thoughts or suggestions?

1 Like

Thanks for the bug report! I've reproduced this locally. I think I can explain 'what' is going on, although I don't yet have grasp of the 'why'.

It looks like, for some reason, in your vignette lines of code are getting some extra HTML styling. Using Right Click -> Inspect Element, I see:

49%20PM

Note that each line of code is wrapped into an <a> tag, with a class sourceLine added. RStudio (for dark themes) injects some CSS to style such anchors:

06%20PM

This does the right thing in plain text, but not for links within code. We'll take a look -- thanks for reporting!

2 Likes