While converting this site to Zola the other day, I noticed that some of the code looked odd. Basically, the styling of the syntax highlighting was off, with the background of the actual code being in one color, but the background-color of the surrounding block was in a different color.
This obviously cannot stand, so I had to fix it.
In the Zola docs on syntax highlighting, I saw that I could specify the highlight_theme = "css"
, and then have the SSG itself output CSS files to use for the highlighting, like so:
= true
= "css"
= [
{ = "ayu-dark", = "css/syntax-theme-dark.css" },
{ = "ayu-light", = "css/syntax-theme-light.css" },
]
Those CSS files end up in my static
folder by default, so I can just pull them in from a template:
Now, the code blocks look better in both light and dark mode.