Quarto revealjs presentation theme with specified code highlighting style

Is it possible to do use a theme for code highlighting when you already use a theme for the revealjs presentation?

Something like

---
title: "Untitled"
format: 
  revealjs: 
    theme: [night]
---

but with highlight-style as discussed here: Quarto - HTML Code Blocks

I can't quite figure out the magical yaml combination.

Links to any docs that show this that I missed would also be appreciated!

What is not working exactly for you ?

Using highlight-style as documented should work

---
title: "Untitled"
format: 
  revealjs: 
    theme: [night]
    highlight-style: arrow-light
---

# Test 

```r
recurse_fibonnacci <- function(n) {
  if (n <= 1) {
    return(n)
  } else {
    return(recurse_fibonnaci(n-1) + recurse_fibonnaci(n-2))
  }
}
```

When no highlight-style is provided, it shows

That works perfectly, thank you!

In general, it isn't obvious to me where options should go in yamls, and I hadn't tried there.

In Quarto we are trying to be clever about the YAML and so you can also put it at the first level and it would work. We are matching the name really and not just the position

---
title: "Untitled"
format: 
  revealjs: 
    theme: [night]
highlight-style: arrow-light
---

Also, if you did not already, you should use the latest version of RStudio IDE (or preview or daily version if you want). In Quarto document, there is now YAML intelligence which means that your YAML will be checked for error in the IDE (and by Quarto) but you'll get also autocompletion for YAML field. So the hihglight-style field would appear if valid to put it there.

Hope it helps

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.