Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

kittyhtml

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kittyhtml

Render HTML to an image and display it inline in Kitty/iTerm2-capable terminals. No browser — CSS layout via DropFlow.

Source
npmnpm
Version
0.2.0
Version published
Weekly downloads
35
-10.26%
Maintainers
1
Weekly downloads
 
Created
Source

kittyhtml

Render HTML to an image and display it inline in a graphics-capable terminal (Kitty, WezTerm, Ghostty, iTerm2).

This is not a headless browser. It's a thin CLI that pipes HTML through DropFlow (a real CSS layout engine, no JS/no Chromium) to a PNG, then emits the Kitty graphics protocol or iTerm2 inline-image protocol on stdout.

Built for AI agents that have something nice to show you — a styled report, a small table, a card — without taking over your screen with a browser.

Install

# from this directory, until published
npm install
npm link        # exposes the `kittyhtml` binary on your PATH

Requires Node 20+. Pulls in @napi-rs/canvas (prebuilt native binary, no compile step) and dropflow.

Use

kittyhtml --demo                              # bundled demo page
echo '<h1>hi</h1>' | kittyhtml --width 400
kittyhtml report.html --scale 2 -o report.png # write PNG to file

Options

flagdefaultdescription
--width N800viewport width in CSS px
--height Nauto-fitfixed canvas height
--scale N1pixel ratio (try 2 for retina-sharp text)
--background CSSfill canvas before painting, e.g. #fff
--format auto|kitty|iterm2autooutput protocol; auto-detect from $TERM/$TERM_PROGRAM
--out, -o PATHwrite PNG to file (use - for raw PNG on stdout)
--demorender the bundled demo page

As a library

import { renderHtml, encode } from 'kittyhtml';

const png = await renderHtml('<h1>hello</h1>', { width: 400, scale: 2 });
process.stdout.write(encode(png, 'kitty'));

Releasing

Releases publish via GitHub Actions using npm trusted publishing (OIDC, no long-lived token). To cut a release:

npm version patch    # or minor / major — bumps package.json and tags
git push --follow-tags

The Publish to npm workflow fires on the v* tag, exchanges a GitHub OIDC token with npm for a one-shot publish token, and publishes with --provenance so each release carries a Sigstore attestation linking it back to the source commit.

CSS caveats

DropFlow implements a serious subset of CSS but isn't a browser. Things to know when writing HTML for it (as of DropFlow 0.6.x):

  • Use the longhand background-color, not the background shorthand.
  • max-width / min-width aren't supported yet — use width.
  • list-style markers don't render; use &bull; or numbers inline.
  • border-radius, box-shadow, transform, and position: absolute/fixed aren't supported yet.
  • Body background doesn't propagate to the canvas — set the background on a wrapper element, or pass --background <css> to fill the canvas.

See the DropFlow README for the full support matrix.

Fonts

First run fetches Noto fonts from a CDN via DropFlow's bundled register-noto-fonts.js. Subsequent renders reuse what was loaded. Bundled offline fonts are on the roadmap.

Claude Code skill

A bundled skill lets Claude Code render output as a styled inline image when you ask for it as "kittyhtml" or "khtml":

mkdir -p ~/.claude/skills
cp -r skill/kittyhtml ~/.claude/skills/kittyhtml

Then in any Claude Code session: "give me this report as kittyhtml" — the agent will generate DropFlow-compatible HTML and pipe it through this CLI. The skill is narrow on purpose; it only triggers on those keywords.

How agents should use it

If you're an AI agent on a host with kittyhtml installed and the user is on a graphics-capable terminal, pipe your HTML through it instead of dumping markup as text:

echo "$HTML" | kittyhtml --width 700 --scale 2

The image is one frame in the scrollback — no popups, no new windows.

Keywords

kitty

FAQs

Package last updated on 13 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts