Skip to content

MuscleGear5/webcat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

webcat

cat for the web. Render web pages and markdown right in your terminal — with real inline images, not just URLs.

webcat fetches a page, strips away the nav/ads/clutter, renders the text beautifully, and draws the images in place using your terminal's graphics protocol (kitty / sixel / iTerm2), with a Unicode-block fallback for plain terminals.

webcat https://github.com/alibaba/page-agent

Why

curl | less gives you HTML soup. Reader-mode tools give you text but drop the images. webcat gives you the clean article and the pictures, in document order, without leaving the terminal. Great over SSH, on a phone (Termux), or anywhere a browser is overkill.

How it works

webcat is a small orchestrator over three excellent tools:

Stage Tool Job
Fetch & clean defuddle URL → clean markdown
Text glow render the markdown
Images chafa draw each image inline

It walks the markdown in order, sending text to glow and image URLs to chafa, so everything lands where it belongs.

Backends

webcat has two rendering engines, selectable with --engine:

  • stitch (default) — glow for text + chafa for images, stitched together. Most compatible: chafa auto-detects the widest range of terminal graphics protocols. Only needs glow and chafa.
  • mdcat — if mdcat is installed, it renders text and inline images natively in a single pass. webcat finds it on PATH or in ~/.cargo/bin. Note: mdcat supports fewer terminals than chafa, so images may not appear everywhere.
  • auto — use mdcat if present, else fall back to stitch.

If images don't render with one engine, try the other: --engine stitch is the safe bet.

Install

git clone https://github.com/MuscleGear5/webcat
cd webcat
./install.sh

The installer detects your platform (Termux, Debian/Ubuntu, Fedora, Arch, macOS), installs the dependencies, and drops webcat into ~/.local/bin.

Manual install

Install the deps yourself, then copy the script:

# deps (pick your platform)
pkg install glow chafa            # Termux
brew install glow chafa           # macOS
sudo apt install glow chafa       # Debian/Ubuntu
npm install -g defuddle           # all platforms (needed for URLs)

install -m 755 webcat ~/.local/bin/webcat

Termux note: npm CLIs ship a #!/usr/bin/env node shebang, but Termux has no /usr/bin/env. The installer runs termux-fix-shebang on defuddle automatically; if you install by hand, run it yourself.

Usage

webcat <url>              # fetch a web page, render text + images
webcat <file.md>          # render a local markdown file
cat file.md | webcat      # render markdown from stdin
webcat <url> -w 80        # set render width (columns)
webcat <url> --img-height 10   # smaller images (default 14 rows)
webcat <url> --no-images  # text only
webcat --help

Terminal image support

Images render at full fidelity in terminals that speak a graphics protocol — kitty, sixel, iTerm2, and modern Termux builds. chafa auto-detects this. In a plain terminal you still get a recognizable Unicode-block rendering.

Smart sizing by pixel dimensions: images smaller than --img-threshold (default 200px in both dimensions — icons, badges) keep their true natural size and are never enlarged. Larger content images scale up to fill the width so they aren't tiny on high-DPI screens, capped at --img-height rows (default 24). Width is always capped to your terminal so nothing overflows.

All image types render, including SVG (e.g. shields.io badges, which webcat rasterizes to PNG via rsvg-convert/ImageMagick), data: URIs, and local image files referenced from a local markdown file.

Notes

  • [webcat: skipped image — access denied ...] means the server refused to serve that image (HTTP 401/403). webcat sends a Referer/Origin matching the page, which satisfies most hotlink protection — but some CDNs use signed, expiring URLs tied to the original page session, which can't be fetched separately by anything. Those are skipped; the rest of the page still renders.

Dependencies

  • python3 — runs webcat (no third-party Python packages)
  • glow — markdown text rendering
  • chafa — terminal image rendering
  • defuddle — URL → markdown (only needed for URLs; local .md works without it)
  • librsvg (rsvg-convert) or ImageMagick — optional; rasterizes SVG images so they render

License

MIT — see LICENSE.

Credits

Stands entirely on the shoulders of defuddle, glow, and chafa.

About

cat for the web — render web pages & markdown in your terminal, with real inline images

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors