BIG BROWSER DOESN’T WANT YOU TO KNOW THIS
real talk:
every terminal web browser you’ve heard of is faking it
. browsh, carbonyl, all of them, they boot up a full headless chrome in the background and just screenshot it into your terminal. it’s chrome wearing a terminal costume.
so i’m building the real thing. you type a URL, and my code fetches the page, parses the HTML, and lays it out as text in your shell, with a custom engine no chromium. no webkit. no html library doing the hard part. it’s called newt.
and it already works??
(kinda) it’s reading the wikipedia article on salamanders right now: headings get a rule under them, paragraphs wrap to my terminal, links and refs work.
my biggest bug so far: whitespace (grrr). my first render had a space before every comma and printed refs as “[ 2 ]” instead of “[2]”. turns out a link and the comma after it are separate chunks of text in HTML, and i was gluing them back with spaces that were never there. the fix is genuinely the hard part of a browser: layout has to remember whether real whitespace existed between two chunks. so now every word knows if it has a space in front of it, and it only wraps at real spaces (also why “lizard-like” doesn’t snap in half). So dumb
next:
teaching it to read CSS so pages look like themselves. no color, clicking links, or scroll yet. This is gonna be amazing
Comments 1
peak project twin!! keep it going!
Sign in to join the conversation.