Hacker News new | ask | show | jobs
Show HN: I made a browser extension that fixes Hacker News' block formatting (github.com)
18 points by corollari 2462 days ago
5 comments

Here is an example of the problem this extension fixes:

  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
My “solution” is to add asterisks around the text to make it Italic, like so:

> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Here are the official formatting guidelines: https://news.ycombinator.com/formatdoc

Here is the correct fix for that:

> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lines starting with four spaces are for code, not for quotations. In that situation you usually really do want a horizontal scroll bar rather than line wrapping, and this breaks that for actual code. That's also why it uses a fixed width font, which makes no sense at all for quotations.

Hacker News is deliberately very light on formatting, and I prefer it that way. The only thing that needs fixing is a bit of user education not to misuse the block formatting feature. Maybe there should be a list of formatting options below the reply box, with the idea of just sticking a text annotation on quotations mentioned explicitly. (A comment preview would also be nice, mostly so you could read your comment back in a proportional-width font before you post it.)

Describing your advocacy against the official position as “fixing” is playing political games with framing and will worsen the site experience for the rest of us as users install and use it.

The official policy says:

https://news.ycombinator.com/formatdoc

> This is intended for code.

The Stylus addon is a more generic solution, it works on phones: https://addons.mozilla.org/en-US/firefox/addon/styl-us/

As a bonus, you can fix the ‘[-]’ comment collapse link by making it five times wider. And crank up the font size.

The primary annoyance with this approach is that you can't look up the tag hierarchy and classes on a phone, at least I haven't found an extension that would let me do it even on the desktop (even though I think I've seen some, years ago).

An even larger hammer you can use is injecting arbitrary JS using Violentmonkey; that lets you do pretty much anything. It also works on phones.

https://addons.mozilla.org/en-US/firefox/addon/violentmonkey...

I'm using the classic GreaseMonkey, but I find that my attempts don't match Stylus: the styles get applied after the page is already loaded, so everything is reformatted and jumps away from my view (in cases of heavier formatting, e.g. changing fonts). So basically, Stylus encapsulates accumulated knowledge of properly applying styles in an extension. Plus, it can change them without reloading the page.
Am I "missing" something? I don't get those scrollbar comment layout... Where is the problem being fixed?
It's only really a problem on mobile
I wasn't aware you can use extensions on mobile Chrome... Anyway, I use an app for HN on mobile. Much nicer experience. (Materialistic is the client du jour)
To my knowledge, you can't. You can use many, if not most, Firefox addons on mobile (I use ublock on FF mobile, which is nice). This extension is for Firefox.

I'm not really sure if Firefox addons/extensions work well in iOS. I can imagine a few reasons it might be more limited, but I don't have an iPhone to test.

I'm on mobile and I don't see any problems
Why isn’t HN open source? It is after all hacker, news
An older/vanilla version of HN is. Since then, secret sauce algorithms have been added. If it was public, it might be easier for someone to game the system.

It's written in Arc (a dialect of Lisp) and included in the Arc distribution:

https://news.ycombinator.com/item?id=1390685