Perhaps you could use CSS. There's an attribute white-space which allows you to make tags behave like <pre> tags for whitespace, without altering the font or anything else.
I have no idea how compatible this is with preserving the default outline showing behaviour in browsers.