Copying from obsidian reading mode also copies the background color

Steps to reproduce

Copy any text and paste it in a place that recognizes html, like Anki or Microsoft Word. If it is in dark mode it copies the background color as if it were part of the format (the same is true in the light mode, but it is more difficult to realize).

Edit: It works perfectly if between the copied text there is a blank line or a list (ordered, unordered, or task list).

Expected result

Paste just the markdown format (without the symbols), if in bold, paste in bold, but don’t paste any color.

Actual result

This text:
I was going past the house where the cat and the dog lived.

Is pasted like that:
WINWORD_20-06-14-45_479x235
Whit this code copied:

<span style="color: rgb(216, 216, 216); background-color: rgb(41, 44, 46);">I was going&nbsp;</span><strong>past</strong><span style="color: rgb(216, 216, 216); background-color: rgb(41, 44, 46);">&nbsp;the&nbsp;</span><em>house</em><span style="color: rgb(216, 216, 216); background-color: rgb(41, 44, 46);">&nbsp;where the&nbsp;</span>cat<span style="color: rgb(216, 216, 216); background-color: rgb(41, 44, 46);">&nbsp;and the dog lived.</span>

Environment

  • Operating system: Win10 64bits
  • Obsidian version: 0.6.7
  • Using custom CSS: Yes. I tried to remove the CSS and use the default, the result was the same.
5 Likes

Linking to another preview copy bug https://forum.obsidian.md/t/preview-mode-text-copy-does-not-copy-entire-selection/4517

In word you can do paste->merge formatting.

Boosting this, it is infuriating when I want to share meeting notes around at work.

  • If I copy the markdown there is no background colour, but outlook doesn’t recognise md.

  • If I copy the preview, it copies the dark theme background as well, and there is no way to remove this background in outlook after I paste. Pasting without formatting removes ALL formatting, so that’s not an acceptable solution.

In order to get a usable rich text version I have to copy the markdown out of Obsidian and paste it into a web-based markdown renderer, then copy the output of that and paste it into my email… this is not a good workflow.

1 Like

The issue is still there — and it’s quite unacceptable, really. Anyone found a decent workaround yet?

1 Like

The work around solution is to press Ctrl then M, (not Ctrl+M) immediately after pasting.

Another alternative is installing PowerToys and enable its Paste As Plain Text part to allow you to use Win+Ctrl+Alt+V (configurable) to always paste as plain text.

PowerToys is awesome if you are on windows.
If you are the type of person who would take the time to read this post in this forum and are using windows - get it.
The ability to remap Capslock to Ctrl alone makes it a must have. And there are many other great features.

Because it’s Microsoft, IT Admins are more likely to install it on a work computer. There are other tools - but IT Admins are more wary of installing them.

If you want to merge your formatting - use the method I mentioned. If you don’t need the formatting then the PowerTools is 1 less key press.

I’ve encountered the same issue. The “Copy as HTML” plugin helped me.

Hi!
So this still appears to be an issue when copying from Reading View, as of the latest public (1.4.16) and catalyst releases (1.5.2).
From looking at similar issues in other editors, it’s possibly an issue with nested styles, and might be inherited from the renderer used (PrismJS I think) or perhaps the clipboard code.