Copy as HTML for codeblock?

Within a note I’d like to store html email templates in blocks that I can copy with a single button (like a codeblock), but pasting an html email into a codeblock turns it into markdown code, which doesn’t turn back into html when I copy the code using the codeblock copy button and paste back into thunderbird.

There’s the “Copy as HTML” addon which does seem to work, but requires me to manually select the contents of the codeblock. Is there a way (native or extension) to have a block in obsidian with a “copy” button that copies the contents as HTML? The box should ideally do normal markdown rendering, but even the codeblock view would work…

When pasting the HTML code into Obsidian, try using the shift key to paste as raw unformatted code.

shift + cmd + V on macOS

shift + ctrl + V on Windows

Under the Edit menu:

Hope this helps!

Thanks for the reply! Yes, that would work if I was ok losing the formatting which I’m trying to preserve :slight_smile: Specifically hyperlinks. While plaintext might be what I’ll have to go with in the end, I’d much rather if the email had the word “document” as a link than showing the actual long, ugly URLs to gdocs, for example.

It wasn’t clear how and from where you were originally copying the HTML code. But you are not actually copying raw HTML code, but rich text from an email message?

I believe Thunderbird has a view source option where you could see the underlying HTML code and try copying that.

Good luck…

Oh, right. Richt text is the correct term, sorry. Yeah, I can view HTML source in thunderbird and even paste it back in, so: view html in thunderbird → paste into codeblock → copy codeblock → paste html into thunderbird is doable, but not the most comfortable workflow :grinning:

Especially since pasting rich text into obsidian turns it into easily editable markdown (as opposed to ugly HTML mess) and so it’s infinitely more practical to just do that that and then copy as HTML and paste to thunderbird normally as rich text again.

What I really want is a simple block with a “copy as HTML” button. Similar to codeblock, but one that renders regular markdown like the rest of the note, yet allows “copy as HTML” with a single click and without manual selection of text. That should be doable as an extension, right? I’ll have to look into that.

Does this plugin help?

FYI, I am the author of the plugin.