3 ms·
> are not shown to readers. I also wonder, why conceal bits of information from readers, while they could possibly benefit of them the same way editors and wri
by myfonj 1y ago
> are not shown to readers.
I also wonder, why conceal bits of information from readers, while they could possibly benefit of them the same way editors and writers do. Admittedly, the outcome then seem like a poetry, but … why not?
To give it a shot on that page, simple way to see these breaks it to run
document.body.insertAdjacentHTML
( 'afterend'
,`<style>p, li { white-space: pre-line; }</style>`
)
in devtools console. (Using `pre-wrap` instead of `pre-line` is also interesting: indents "wrapped" lines by the source code indent, what gives it even more clarity.
(By the way, HN comments
also
preserve
line
breaks
in
the
source output, but unless revealed by some extra style, they are usually not presented on the surface.)
- bmacho 1y agoHere's a userscript to apply it automatically, and show all the extra whitespaces people put in their comments. (There aren't many.) // ==UserScript== // @name HN comments show whitespace // @description Changes HackerNews CSS to show comments with original whitesapaces // @match https://news.ycombinator.com/* // @run-at document-body // @grant none // ==/UserScript== // HN inserts a newline after <pre> so formatted code blocks have a whole newline after them // but we can remove that extra space with negative margin const HN_noformat_CSS_rule = ` div.commtext.c00 { white-space: pre-wrap !important; } div.commtext.c00 > pre { margin-bottom: -.25em !important; } `; let myStyleHolder = document.createElement('style'); myStyleHolder.textContent = HN_noformat_CSS_rule; document.head.appendChild(myStyleHolder);