Automatically paste as plaintext when the cursor is inside a code block

Use case or problem

When copying and pasting text that goes inside code blocks they should be pasted as plaintext by default, I can’t think of a reason where converting to markup inside a code block is the desired outcome or even if it is even common. That might be my bias flying high, so correct me if that is a wrong assumption.

Proposed solution

I know we have context menu and shortcuts to paste as text, but doing the right thing™ automatically is a better experience. If the cursor is inside a code block pasting should automatically paste as plaintext.

Is this the end of the world? No, but if my assumption is correct - that inside code block we always want plaintext - it is just much nicer to use.

Current workaround (optional)

Use the shortcut or context menu after you’ve already pasted and Obsidian did the wrong thing by inserting a bunch of markups inside the code block.

Related feature requests (optional)

2 Likes

+1, I think this should be the default behaviour. If the text inside a codeblock is rendered as-is, then there is no reason to escape underscores.