rstudio / revealjs

R Markdown Format for reveal.js Presentations
Other
325 stars 86 forks source link

Supports highlightjs using RevealHighlight or usual R Markdown way ? #118

Open cderv opened 2 years ago

cderv commented 2 years ago

R Markdown has current usually support for highlight.js through highlight: paramater: https://pkgs.rstudio.com/rmarkdown/reference/html_document.html

revealjs currently only support Pandoc's syntax highlighting through the rmarkdown::pandoc_highlight_args() function.

However, the template already have the loading of the library but it is not really included and I don't think that works https://github.com/rstudio/revealjs/blob/1b2048391c0b4a133757b03857ca56ceb1fb91c3/inst/rmarkdown/templates/revealjs_presentation/resources/default.html#L21-L26

Also, reveal.js seems to have support through a Plugin : https://revealjs.com/code/ This brings features like

cderv commented 2 years ago

I think the above is really old code that was once used in rmarkdown but removed in rmarkdown 1.2 https://github.com/rstudio/rmarkdown/commit/d4aaf99b6510df18c0e4ea2c546940e805d131b0 following the switch to use highlightjs with htmldependency

We should use the revealjs way IMO

cderv commented 2 years ago

Currently, highlightjs is never used because of https://github.com/rstudio/revealjs/blob/cc46ea0f68eb62f7c24f19c044ace57223053a9a/R/revealjs_presentation.R#L228-L229 which will only set Pandoc's highlighting.

In rmarkdown, highlightjs can be triggered using rmarkdown:::pandoc_html_highlight_args() and the default template.

So I believe no risk to remove this from the template.