I keep a TiddlyWiki for documenting bits of code, scripts etc. In TWC, I had a homegrown plugin that added a “Copy All to Clipboard” button to every code block. (Eventually, it degraded to “Select All”, when manipulating the clipboard from a web page became impossible, with tightened security in a newer version of Firefox.)
I was missing that functionality in TW5, but didn’t want to rewrite the plugin since I would not be able to make it copy to clipboard anyways. Finally, it occured to me that there might be a browser add-on that could do the same. All that is required is copy inner HTML from an element on a right click. It wasn’t easy to find, but there it is: https://addons.mozilla.org/en-US/firefox/addon/texttotag/
After installing it, right click on your piece of code, select “TextToTag” from the menu and voila - the code is in your clipboard.
When clicking, make sure you are pointing to the text, and not to the whitespace between the lines or on the right-hand side in a block of code. And if you find that limitation inconvenient, you can click anywhere within the block of code if you add this to your stylesheet:
pre code, pre.hljs code { display: table; }
Enjoy!
—R