Stop removing whitespace when I hit "Update"?

I want to store my posts in plaintext markdown instead of HTML. I have started by following Store post in raw markdown format, no html?, and as a result I do get what seems like a plain text box as my editor. However, when I hit update, the spaces that I indent code blocks with are being removed (as described here).

(UPD. This actually happens on blur from the text box; it just normally coincides with a click on the Update button, that's why I initially thought the button listener causes the whitespace removal.)

With trial and error, I concluded that when I remove the recommended add_filter( 'user_can_richedit', '__return_false', 50 ), the spaces are no longer removed (while yes, I do revert back to the rich editor – which contradicts the whole markdown idea).

I found several solutions that don't work for me (or at all):

Topic markdown html-editor visual-editor Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.