Adding a button to show and hide code block


#1

Whenever I insert ``` code embedding, I want to add a simple button to show or hide the block.

How can I add this function?


#2

Probably some Javascript/CSS combo. Please search elsewhere for that kind of knowledge. These forums are for Hugo-specific support. :slight_smile:


#3

I can make a hide-show button by javascript using custom shortcode. But I want to modify the default mechanism for ``` code block. I am not sure where I have to modify.


#4

Using three backticks for code is called “code fencing”, and the marks are “code fences”. That should help you figure out where to change that, please use the search on these forums and abroad.


#5

Okay, thank you very much!