Using highlight_theme = "css" by itself

Hi, I have been using Zola for a while (since 0.11) and have been, and still am, very happy with it.

I was looking to try the new highlight_theme = "css" feature available in 0.14.1 but I can’t get Zola to output the css classes unless I also use highlight_themes_css option.

I used the highlight_themes_css option to generate base CSS-files into static that I’ll be able to use to customize the CSS, but as soon as I remove highlight_themes_css the code for my code blocks (triple backtick) revert to hardcoded color values.

I guess that maybe I’m missing a configuration option, maybe?

The docs are not super clear about that but I don’t think highlight_themes_css should be required to have class based highlighting…

Sounds reasonable. Should I open a ticket on GitHub?

go for it

After downloading the source code and having a second look, I found this section:

        for t in &self.config.markdown.highlight_themes_css {
            let p = self.static_path.join(&t.filename);
            if !p.exists() {
                let content = export_theme_css(&t.theme);
                create_file(&p, &content)?;
            }
        }

which feels very intentional - if the highlight_themes_css have already been generated (the files exist), zola does not create them again.

When reading the documentation, this wasn’t very clear, but reading the code made it sort of clear anyway.

My conclusion is that to get this working you slap highlight_themes_css in there to generate the files the first time, and then you can modify them to your liking (or regenerate them if you remove them).