Skip to content

Add copy to clipboard button for code snippets #977

@eljhkrr

Description

@eljhkrr

While going through the v4 setup guide, I had to manually copy text blocks containing shell commands:
image
It would be very useful if users could have a copy to clipboard button to grab the whole set of commands at a go like in the example below:
image
There are a number of workarounds both in the hugo ecosystem and using vanilla JS that can be adopted to add this functionality. A few examples:
https://digitaldrummerj.me/hugo-add-copy-code-snippet-button
https://www.dannyguo.com/blog/how-to-add-copy-to-clipboard-buttons-to-code-blocks-in-hugo/

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions