It is jarring, but taking the background colour away entirely leaves it hard to tell what is code and what isn't:
I think we should consider a third option, ether a lighter grey:
Or something else:
Just for reference, this is what we currently have:
The short answer is "so the parser can pick up what you intend"
The longer answer involves experimentation with regexes. I really don't think that's necessary.
Here's your basic rule of thumb: HTML doesn't care about whitespace, and neither should you (except when it's used as the four spaces to indicate indentation but that isn't whitespace, that's ...
If there were no downsides, I wouldn't be so against this revisiting of an old proposal. Who could object to something that would give us more formatting options for free? In reality though, there are downsides to consider:
Client-side rendering performance. For an example heavy page, see https://math.meta.stackexchange.com/questions/5020/mathjax-basic-...
You can find some online tools for this purpose, but I think you should take a look at that Max Vernon's question:
Minimal, Complete, and Verifiable Example
Quoted from the question:
Include test output, in text formatted as a table, to show both what
you're currently getting as well as what your desired output should
be. Search for "ascii table ...