HACKER Q&A
📣 asdff

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?


  👤 taviso Accepted Answer ✓
I don't know the answer to your question, but I see no reason I couldn't add hn support to nntpit, if there was interest.

https://github.com/taviso/nntpit


👤 nazri1
Use mutt! Now you can read each post as if it was part of an email thread. But first you have to get the comments saved as a maildir email conversations... that’s where my fetchpost[1] tool comes in. Demo: https://asciinema.org/a/593u87rrsa3mevktyekepm4ke

[1] https://github.com/holygeek/fetchpost


👤 linguaz
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;
  }

👤 zxcvbn4038
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.

👤 akalsz
w3m indents stuff correctly for me, using the version maintained for Debian: http://github.com/tats/w3m

👤 abrolhos

👤 GekkePrutser
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

👤 Kinnard
You should also post on the arc forum which shares code with HN: http://arclang.com/forum

They're both written in arc by pg: http://www.arclanguage.org/


👤 awefawef
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)

👤 yewenjie
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.

👤 every
links2 does not indent but links2 -g displays properly...