rstudio / bookdown

Authoring Books and Technical Documents with R Markdown
https://pkgs.rstudio.com/bookdown/
GNU General Public License v3.0
3.77k stars 1.27k forks source link

Feature request: custom syntax highlighting themes #942

Open jefelino opened 4 years ago

jefelino commented 4 years ago

Since version 2.0, pandoc has supported custom syntax highlighting themes, provided in a .theme file which is passed as an argument to --highlight-style (see [https://pandoc.org/MANUAL.html#syntax-highlighting]()). But if I try to provide a custom theme file using the highlight field in my _output.yml file, bookdown halts with this error message:

Error in match.arg(highlight, highlighters()) : 
  'arg' should be one of “default”, “tango”, “pygments”, “kate”, “monochrome”, “espresso”, “zenburn”, “haddock”, “breezedark”
Calls: <Anonymous> ... get_base_format -> do.call -> <Anonymous> -> match.arg
Execution halted

Exited with status 1.

It would be better to allow parameters that include a .theme extension to go through to pandoc.


By filing an issue to this repo, I promise that

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

cderv commented 4 years ago

Is this a question specific to bookdown or related to Rmarkdown ?

I believe you can do that in rmarkdown for html_document but only if you use a custom template too (by setting template argument). I think this is by design as the defaut rmarkdown template works well with provided theme.

Anyway, we need more information I think:

Thank you !

cderv commented 3 years ago

This is a limitation of rmarkdown for now. It should be done there first https://github.com/rstudio/rmarkdown/issues/2035