Quoting another post via highlighting is really handy, but when quoting code, > gets escaped to >. It's probably a Discourse bug, but a particularly problematic on this site, given most code here will contain %>%. Other symbols likely do the same thing, though I haven't encountered them yet.
Is this fixable? It's deleterious for reproducibility.
I think it's actually subtly different; that issue is about maintaining formatting (which would be nice too), but this is about maintaining the actual text. In this case the text is getting there, it's just left as HTML escaped instead of rendered.
Copy and paste directly. This is probably the easiest way to get a small chunk of a large portion of code.
Use the q shortcut key to quote the entire post, and delete the sections you don't want. Getting it to work may involve clicking somewhere in the post, or using the j/k navigation keys to select the post.
But I agree with you that it's a bug, and it doesn't seem to be directly addressed by that linked post.
Thanks for the heads-up re the navigation and quotation keys. I can see y'all's point about quoting the actual text seeming to be a good solution and a smaller task than inverting from html to markdown.
For my purposes, q + j/k works well enough. Even if y'all got your way, with the hover-quote grabbing the rendered text (just as you'd get by copy-paste), you've got hazards like this one from @alistaire's opening sentence, copy-pasted here using > for a quote block:
gets escaped to >
or copy pasting into a [quote] block:
You'll really want to quote with all the markup and for that, only the behavior of the q shortcut seems adequate:
What I find annoying is that when I use the shortcut (attempted just now), it doesn't drop it in my existing edit but instead constructs a new post, so I need to copy-paste that back into my in-progress edit (assuming it wasn't lost along the way). So when I'm quoting from multiple posts, it'll be a hassle.
(Btw, I'm using keyboard-button markup from SO above.)