Hacker News new | ask | show | jobs
by Theodores 2984 days ago
'white-space: pre' is what I learned there. Never knew such a thing could be possible. This means no need to do a 'nl2br' on the content if it contains no HTML, this is a common scenario, I am going to see if 'white-space: pre' just makes everything magically look okay.
1 comments

The trick with that is that it also prevents wrapping except on new lines in the source. Looking at the potential values, I'd recommend pre-wrap instead, which at least allows avoiding horizontal scrolling, at the cost of requiring you to write the entire contents in a single line of markup. Annoyingly, it doesn't seem like there's a way to avoid multiple spaces being collapsed without also giving special meaning to keeping the source less than 120 characters (or whatever other measure) wide.