r-lib / pkgdown

Generate static html documentation for an R package
https://pkgdown.r-lib.org/
Other
713 stars 335 forks source link

Permit use of highlight.js themes #2058

Closed JosiahParry closed 2 years ago

JosiahParry commented 2 years ago

Presently the syntax highlighting is limited to the styles defined at https://github.com/r-lib/pkgdown/tree/main/inst/highlight-styles.

It would be nice to be able to specify a highlight.js theme in the _pkgdown.yml file.

I've tried adding it as an include via in_header: with the stylesheet link to no avail.

Perhaps there are other work around that I am unfamiliar with, but this would be a very nice addition.

For example I can imagine syntax looking like:

template:
  bootstrap: 5
  bootswatch: cyborg
  highlight_js_theme: atelier-estuary-light
maelle commented 2 years ago

Some rapid (but late) pointers.

Currently the highlighting by downlit is not removable.

Were you looking to use highlight.js for the styling (i.e. not to not use downlit?)? Then I think you should look adding custom CSS (as I see you already saw the default themes).

maelle commented 2 years ago

Related #2033

hadley commented 2 years ago

It would be nice, but pkgdown doesn't use highlight.js so this would be a lot of work.