How do I put a code window like this in a Hugo post?

  • code should be selectable and copyable
  • I want the surrounding window to look & feel

This is mostly a CSS question so outside of the scope of this forum.

Hugo functions that can help you are:

With this render hook you can adjust the markup of code blocks making it easier to style.

Hugo also have support for Chroma syntax highlighting that you might find useful:

Thanks a lot, Code block render hooks | Hugo is what I was looking for.

That’s how it finally looks like https://www.youtube.com/watch?v=l5PwpHYpBJ4

1 Like

That looks pretty neat!

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