It would be wrong to fix that with CSS. Line breaks serve 2 purposes: 1) Content, 2) Code Formatting. So, there's no way to determine whether the line break is one or the other there. As such, it's interpreted as a space in those cases.
e.g.
a paragraph. And it has
2 sentences.
<pre>But this is preformatted
text
and
displays
as
I'm not sure if my spaces at the ends of the lines will be rendered here. (Most lines have no spaces.)
Try using a text editor that doesn't automatically break lines. That should solve the problem.