Hugo - CSS Class reference

This class reference is valid for all Hugo and Go grammars.1

Core modes used

Standard scopes (classes)

The following standard scopes are used to style the output. Make sure your style has a definition for them.

New scopes (classes)

Themes out in the wild won’t define styles for these2. Define your style or live with the standard Highlight.js fallback mechanism.

Nested selectors

Each nested scope gets an own class with added underscores for each nesting level.

Here’s a layout for property.method.

Keywords

We divide Go/Hugo keywords into the following standard scopes.

HINT: We generate the Keywords for Hugo at build time using a recent version of the docs. Means highlighting old code won’t detect ancient keywords/built_ins. The Go template keywords are handcrafted from the docs. Hopefully that’s a complete fetch.

Sub modes

The HTML grammars use Highlight.js XML grammar as subLanguage. Check the official documentation for scopes used there.


  1. we add this file to every source module to have that complete. Watch out for special mentions. ↩︎

  2. also the template-... scopes may be missing in some popular styles. ↩︎

  3. which is mentioned deeper down in the go template docs. ↩︎

  4. A more natural fit for us. ↩︎