Mixing syntax highlighting styles


Is it possible to mix different syntax highlighting styles on one site?

For example, style #1 for shell commands and style #2 for programming languages.

Judging from the documentation, it seems to be not supported with site configuration. If I generate CSS for the two styles, would it be possible?

Your help would be much appreciated.

I suppose in theory, you could:

Create a new shortcode, eg codebox.html

<div class="{{.Get 0}}">
{{% codebox "style1" %}}
<h1>Your Code Here</h1>
{{% /codebox %}}

You should then have a <div class="style1"> enclosing your code block. Modifying your syntax highlighting css accordingly, and you should be able to use different styles as you like.

1 Like