Enhanced CopyCode plugin
I'm using your CopyCode plugin for Docsify. It works great. But I see some enhanced versions of it on GitHub and your cdnjs library webpage. The image below shows three versions of it.
- The one available here only has a
Textcopy button. - The one on GitHub when I preview a markdown page has
Copyicon as the button. It also displays aPlay/Pauseicon when it detects a .gif file - The one on your
cdnjssite that has aCopy URLicon, a "Copy Script Tagicon and a 1Copy SRI Hashicon.
Do you know where versions of these enhanced CopyCode plugin are. Or perhaps you could point me to some code that I might use to create such a plugin myself. One that works with any markdown add-in script would be great, as I suspect the GitHub site is using.
Hi @robinmattern
I don't know off the top of my head which library Github is using for these enhanced copy-to-clipboard buttons. It is likely something they build in-house. If you want to create your own plugin, you could start by forking this repo and then changing it to your needs. The code is only a single JavaScript file with some CSS. It finds any <pre> tag with a [data-lang] attribute and adds the copy-to-clipboard button to it.