Add a button for copying code to clipboard to code blocks on preview

Hi Takuya

It would be great if you can implement a button in every code block (preview view) to copy the content of the code block into the clipboard. Maybe a copy icon in the top right corner of the block? This is relevant for the Desktop app version. I have many PowerShell code snippets documented which I use periodically.


Hi Claudio,

Thank you for the suggestion.
Copy button sounds useful.
However, I guess it would be a personal preference because it may be distractive for some people since it is basically a note-taking app.
So it would be great if it’s a plugin.
Your plugin submission will be appreciated!

Hi , I have been looking into this, but was wondering how I could get the code context
I have seen other examples of people doing this such as ,

but it seems I would need to get the code context from the main editor in inkdrop.
Is this possible through sifting through the body or should it be connected to the class gfm-codeblock-bg?

Would love some advice on how to make the plugin

1 Like

There’s already the copy-code-to-clipboard plugin for this.

1 Like

Ah, was looking for some low hanging fruit that I could maybe contribute.

Thanks for the heads up!

That’s a plugin made by a user Takamitsu-san.
Thanks for considering to make a plugin, @kkshmz :wink:
And thanks for letting him know, Jasper!