Open robinmattern opened 6 months ago
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.
I'm using your
CopyCode
plugin forDocsify
. 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.Text
copy button.Copy
icon as the button. It also displays aPlay
/Pause
icon when it detects a .gif filecdnjs
site that has aCopy URL
icon, a "Copy Script Tagicon and a 1Copy SRI Hash
icon.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.