Syntax highlighting and .Plain

Syntax highlighting is not really useful if the OutputFormat is just plain text. I use .Plain to make bare .txt versions of blog posts. But then if some part of the content is marked for syntax highlighting, in the plain text OutputFormat version the code indentation is wrong. There’s no more newlines. I’m guessing this is because .Plain just strips away HTML markup afterwards. I couldn’t find a way around that.

Why are you using .Plain in the first place if you’re using syntax highlighting? Can you point to source?

You can use Chroma natively in Hugo (super-face Go implementation for highlighting similar to Pygments) or Pygments (which is slower). You can also use plain old GitHub-flavored markdown with triple back ticks and a language declaration and then highlight on the client using highlight.js.

Have you read this section of the docs?