-
Notifications
You must be signed in to change notification settings - Fork 21
Configure Hugo to allow copying code blocks to clipboard #77
Copy link
Copy link
Closed
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationgood first issueGood for newcomersGood for newcomers
Description
- I have searched the issues of this repo and believe that this is not a duplicate.
Issue
Many static site generators support a copy-to-clipboard button for code blocks. For example, see a Material for Mkdocs example:
GitHub also supports this, for example hover over the code blocks here:
This is especially useful for new users who want to quickly copy out commands such as the installation command that doesn't all fit on the screen at once.
It doesn't seem like this is something that Hugo supports out of the box unfortunately, but there are several guides on it:
- https://simplernerd.com/hugo-add-copy-to-clipboard-button/
- https://aaronluna.dev/blog/add-copy-button-to-code-blocks-hugo-chroma/
- https://discourse.gohugo.io/t/copy-button-to-allow-copying-the-content/36076
- https://digitaldrummerj.me/hugo-add-copy-code-snippet-button/
- https://codepen.io/a-luna/pen/JjYrejL
- https://koki-nakamura22.github.io/blog/2019/10/03/hugo-adding-copy-button/
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationgood first issueGood for newcomersGood for newcomers