Custom Code Fence Prefixing

I am new to Hugo and Syntax Highlighting. I have been looking for a way to provide a prefix for each code line in a code fence.

I have an example screen shot below.

Any help or points in the right direction would be awesome, thanks! :slight_smile:

That’s not possible as it’s not a standard markdown syntax.

*I don’t know if pandoc supports a syntax similar to that… but if does, you might need to switch to using pandoc for markdown -> HTML rendering instead of the default Blackfriday. Note though that this approach will be really slow compared to Blackfriday based rendering natively in Go.

On another thought, you might be able to achieve something like that using a custom shortcode which replaces the beginning of each line in the shortcode .Inner with your specified prefix… may be using replaceRE.

1 Like

Thank you for the response, a custom shortcode works for me. :slight_smile: