Hacker News comment tree indentation on text-based web browsers?
I noticed on every text-based web browser I’ve tried (lynx, links, w3m), hackernews comment threads do not maintain the correct indentation in the comment tree, collapsing all parent and children into a single list. Are there perhaps any easy fixes or workarounds, such as another text-based browser to try, or some other way to parse comment threads that maintains the correct indentation?
I use ELinks, and with the following in my ~/.elinks/hooks.pl (& ELinks compiled with perl support), HN comment tree indentation looks fine:
sub pre_format_html_hook {
my ($url, $html) = (shift, shift);
if ($url =~ m|news.ycombinator.com/item\?id=|) {
$html =~ s|
|' 'x($1/10)|eg;
}
return $html;
}
Have you looked at the hacker news API? There is enough information there to reconstruct a tree and do your own formatting. The only issue I've run into is that after some time changes don't seem to flow to the API any longer so you have discrepancies between the site and the API data - mostly comment orders since the scores don't flow to the API, but updates to text often get dropped.
Is there no dedicated HN console reader for HN using ncurses? I never looked for one but I'd be surprised considering there's so many mobile apps
Comment rendering doesn't even work properly on normal browsers. If I go to a comment section with tons of comments and collapse a huge tree, subsequent collapses will immediately scroll the page all the way to the top, annoyingly. (Firefox, this happens on multiple computers)
HN uses a very non standard way to visually represent comment trees — transparent gifs of different widths instead of real treelike data structures. The behavior of text based browsers is understandable.
links2 does not indent but links2 -g displays properly...