luizdepra / hugo-coder

A minimalist blog theme for hugo.
MIT License
2.65k stars 1.05k forks source link

Add Copy Button #911

Open essesoul opened 1 month ago

essesoul commented 1 month ago

Prerequisites

Put an x into the box(es) that apply:

Description

Click on the button to copy the content of the code block

One-click copying of the content of a block of code is achieved by creating the files static/css/clipboard.css and static/js/clipboard.js

Users can now quickly copy the contents of a block by clicking the button in the upper right corner of the block.

Checklist

Put an x into the box(es) that apply:

General

Resources

Contributors

luizdepra commented 1 month ago

Nice, thank you. But I will need to make some modifications like move the CSS code to SCSS, and overriding the code template to add the button instead of using JS to include it.