Since this is all markdown, markdown allows raw HTML, and you seem somewhat comfortable with HTML, one option is to use HTML elements directly to get what you want.
For example, you could use a <pre> tag to retain both whitespace and styling. If you typed in Obsidian like:
<pre>
This is <strong>one</strong> line
This line is indented <em>four</em> spaces
</pre>
It will render like:
This is one line
This line is indented four spaces
Maybe that’s a viable alternative?
The only thing to be aware of is that markdown syntax won’t work inside of HTML. For example, you can’t use ** for bold or * for italics:
<pre>
This is **one** line
This line is indented *four* spaces
</pre>
is rendered like:
This is **one** line
This line is indented *four* spaces
Notice that the word “one” is not bold and the word “four” is not italicized. You have to use some HTML tag to get that formatting.