hn.today

Fancy Curl Sites

nytpu.com42 points10 comments
Screenshot of Fancy Curl Sites

This explains how a personal site was made to serve fully ANSI-escape-marked pages viewable with curl in a terminal. Inspiration came from earlier curl-savvy sites, but the implementation differs: a few pages were hand-written with ANSI escape codes (the author kept ESC (\x1b) handy in a Vim register and referenced the Wikipedia graphics codes) while the rest of the blog was generated automatically because the custom markup language, Gemroff, already supports ANSI-markup output. That prior design choice and a static site generator that can produce multiple output formats made it trivial to produce curl versions of every post; others who generate terminal UIs on-the-fly (e.g., with ratatui) take a different approach. The write-up notes Windows quirks (cmd.exe disables ANSI by default; PowerShell aliases curl), and mentions that providing a handful of handcrafted pages would be an acceptable, simpler alternative.

Serving the curl output required only small webserver tweaks: Nginx rules to detect curl user-agents, serve the ANSI files statically, and include an override header (X-Original: true) so clients can still request unmodified HTTP responses. The author frames this as a fun, nonstandard but neat gimmick that could be more widely adopted, and adds a short defense of using em dashes, noting Gemroff has explicit em-dash support and critiquing claims about AI-generated punctuation.

Read on nytpu.com10 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

OpenCode 2.0

OpenCode 2.0

OpenCode 2.0 introduces a major overhaul with a unified client/server system that runs automatically on users' machines, improving performance and usability. The update includes new features, an improved API, dark mode, and native apps, making the system more flexible and user-friendly. (anoma.ly)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.