FRESH

Hacker News
Preventing line breaks in <code> elements
14 points by surprisetalk
- You can't parse [X]HTML with regex. Because HTML can't be parsed by regex. Regex is not a tool that can be used to correctly parse HTML.
by pwdisswordfishq
0 subcomment
- Why even bother with the CSS class? Just apply text-wrap: nowrap; to all <code> elements and dispense with the fragile regex parsing.
- Unfortunately this makes it much harder to read on narrow-width screens (e.g. mobile), where the use must scroll horizontally
- The 5 cm example had a line break between the 5 and the cm when I read the page in my phone. A joke?