Code Syntax Highlighting Not Working in my Theme

I was following this guide here to add support for code syntax support:
Doing so, I added these lines to my config.toml:

pygmentsCodeFences = true   # Enable triple backtick 'code fence' markdown
pygmentsUseClasses = false  # Add inline styles, no need to compile extra CSS


However, this is what code snippets look like if I select a language:


This is what it looks like without any language selection:

First, the article you reference is very old.

Second, there is no need to include these lines in your site configuration:

pygmentsCodeFences = true   
pygmentsUseClasses = false  

The pygmentsXXX configuration keys were replaced a long time ago. See:

Third, it would be helpful to see:

  • Your entire site configuration
  • Your markdown

Or better yet…


Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

1 Like

Of course, and thank you for your assistance so far!

Here’s the link to the repo:

Replace all that with:

.highlight pre {
  padding: 1em;

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