shellscape.asm$B950 · chip.bin

shellscape

A terminal web browser in Rust. Parses real HTML, lays it out as styled text, and draws images as colour Unicode art via Chafa, or as actual pixels on terminals that support it.

covershellscape showing the Wikipedia article on the Nintendo Entertainment System in reader mode, with the Famicom logo and a photo of the console drawn as colour Unicode block art by Chafa.
shellscape showing the Wikipedia article on the Nintendo Entertainment System in reader mode, with the Famicom logo and a photo of the console drawn as colour Unicode block art by Chafa.
README.mdshellscape/index.mdx

A text-mode browser in the Lynx tradition, with tabs, history and vi-style keys, that also tries to show the pictures.

How it works

The pipeline is short and fairly conventional:

  1. Fetch. Async HTTP via reqwest and tokio, rustls for TLS, gzip/brotli/deflate decompression, redirect following.
  2. Parse. html5ever builds a DOM, which is copied into a small owned node tree with relative URLs resolved.
  3. Lay out. A renderer walks that tree and produces styled lines: headings, lists, tables, blockquotes, code blocks, definition lists, details, and most inline elements. Text reflows when the terminal is resized.
  4. Draw. Ratatui handles the address bar, tab strip, scrollable content with link highlighting, and a status bar.

Images download in the background and are handed to Chafa. shellscape checks what the terminal can do and picks the best output: Kitty graphics, iTerm2 inline images or Sixel where available, otherwise truecolor, 256-colour or 16-colour symbol art. Chafa’s ANSI output is parsed back into styled lines so it scrolls with the page like any other text. Without Chafa installed, images fall back to their alt text.

The event loop is a single tokio::select! over terminal input, fetch results and image renders, so a slow image never blocks scrolling. Logs go to a file so they don’t scribble on the UI.

Keys

o opens a URL, Tab cycles links, Enter or l follows one, H/L go back and forward. j/k, d/u and gg/G scroll; t, x and 1–9 manage tabs; / searches.

Running it

Rust 1.80+, and optionally Chafa for images.

git clone https://github.com/sadovsky/shellscape.git
cd shellscape
cargo run --release -- news.ycombinator.com