Preventing line breaks in <code> elements
surprisetalk
14 points
20 comments
July 24, 2026
Related Discussions
Found 5 related stories in 127.9ms across 10,409 title embeddings via pgvector HNSW
- Antiquated HTML Snippets and Artefacts patadune · 232 pts · September 08, 2026 · 47% similar
- HTML Can Do That encyclopedism · 32 pts · August 19, 2026 · 46% similar
- Markdown in /src perrygeo · 13 pts · September 21, 2026 · 46% similar
- Coding is not solved firstSpeaker · 468 pts · September 28, 2026 · 44% similar
- How to Write Unmaintainable Code (2015) theanonymousone · 18 pts · July 17, 2026 · 43% similar
Discussion Highlights (4 comments)
danlitt
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.
pwdisswordfishq
Why even bother with the CSS class? Just apply text-wrap: nowrap; to all <code> elements and dispense with the fragile regex parsing.
pimlottc
Unfortunately this makes it much harder to read on narrow-width screens (e.g. mobile), where the use must scroll horizontally
dajtxx
The 5 cm example had a line break between the 5 and the cm when I read the page in my phone. A joke?