Code block copy button

Use case or problem

I use Obsidian extensively to store code for various smaller tasks. Double clicking a code block, pressing ctrl-c and then pasting a code block including the ending newline is tiresome.

Proposed solution

When hovering over a code block, reveal a small button that adds the content of the block to the clipboard, excluding the ending newline.


In my opinion, it is a small, but very convenient function that saves time. I hope it will see the light in the future.

Here you go, Pal…

GitHub - jdbrice/obsidian-code-block-copy A plugin for Obsidian that provides copy buttons on code blocks in preview.

1 Like

Thanks, Markus0000!

Looked it through, wasn’t good enough… So I made a fork from the plugin template and cleaned up the code: GitHub - superDuperCyberTechno/obsidian-code-copy

Pull request opened for the repo: Add Code Copy by superDuperCyberTechno · Pull Request #416 · obsidianmd/obsidian-releases · GitHub

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.