I have .md files and use the three backtick notation to format code blocks. When I run hugo the html created has
<div class="highlight">...</div>
I would like to modify the conversion from md to html so that I can add a “collapse this code” button (using this as a template)
So I would like to get the hugo-converted html to be:
<button type="button" class="collapsible">View code</button>
<div class="highlight">...</div>
I can add the <script>
and css elements but I would have to include the <button>
for every code block manually, and it would be nicer if it could be automated. Is the highlight div created by a shortcode (or something else) that I can overwrite? Is there a ‘correct’ way to do something like this?
(The linked example works with my site, but it is not generalised for all code blocks)
Thank you,
Chris