Should I use a custom CSS for syntax highlighting or the built-in markup style option?

Hello,
I have a website running Hugo, and in the past, I generated a CSS file using the command:

hugo gen chromastyles --style=monokai > syntax.css

which I have been using until now. I don’t recall what led me to that decision, but I didn’t alter the CSS file in any way.

Today, while reading the Hugo documentation, I noticed that the syntax highlighting style can be also set easily with a simple option in hugo.toml, like this:

[markup]
  [markup.highlight]
    style = "monokai"

This would save me from using a custom CSS file. But I’m wondering about the advantage of having a separate CSS file, aside from the fact that it adds classes I can modify. If I’m perfectly fine with the default color themes. In this case, can I simply use the hugo.toml configuration and skip the custom stylesheet?

You can see a comparison of the two approaches here.

1 Like

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