html-anything
v0.1.2
Published
Public local-mode CLI for generating polished HTML from Markdown, text, CSV, or JSON.
Readme
html-anything CLI
Public local-mode CLI for generating polished HTML from Markdown, text, CSV, or JSON.
The CLI does not call an HTML Anything server. It uses bundled templates and a local AI agent CLI installed on your machine, then writes local HTML files.
Install
Run without installing:
npx html-anything doctor
npx html-anything generate article.md --auto --target h5Install globally:
npm install -g html-anything
html-anything doctorRequirements:
- Node.js 20 or newer
- At least one supported local AI agent CLI, such as
claude,codex, orgemini
Quick Start
# Diagnose local readiness
html-anything doctor
# List bundled templates
html-anything templates
# List bundled pre-rendered samples
html-anything samples
# Write a bundled sample without calling an agent
html-anything sample travel-flight-deal-xhs -o demo.html
# Generate responsive HTML with automatic template matching
html-anything generate article.md --auto
# Generate mobile H5 HTML
html-anything generate article.md --auto --target h5
# Export generated HTML as a mobile long image
html-anything export image article.html --long
# Export with platform-specific image defaults
html-anything export image article.html --platform xiaohongshu
# Generate with a chosen template
html-anything generate article.md -t doc-kami-parchment --target responsive
# Print a machine-readable manifest after success
html-anything generate article.md --auto --jsonBy default, file input is saved next to the current working directory as <input-name>.html. Use --output or --output-dir to control the destination.
Commands
doctor
html-anything doctor [--json]Checks local configuration, bundled template availability, detected AI agents, and renderer status. Doctor never calls a server.
generate
html-anything generate [input] [options]Primary public command.
| Option | Description |
|--------|-------------|
| --auto | Match the best bundled template automatically |
| --template, -t <id> | Use a specific template |
| --agent, -a <id> | Use a specific local AI agent |
| --model <id> | Pass a model name to the selected agent |
| --target <type> | Output target: pc, h5, or responsive; default is responsive |
| --format <type> | Input format: markdown, text, csv, or json; default is markdown |
| --output, -o <path> | Write to a specific HTML file |
| --output-dir, -d <dir> | Auto-save generated files into a directory |
| --json | Print a JSON manifest to stdout after successful file generation |
When input is omitted, content is read from stdin.
templates
html-anything templatesLists the templates bundled inside the npm package, grouped by category. Each row includes target capabilities such as [h5], [pc], or [responsive,pc,h5].
samples
html-anything samples [--json]Lists bundled pre-rendered samples. This is read-only and does not call an AI agent.
sample
html-anything sample <template-id> [--format html|md] [--output <path>] [--json]Writes a bundled sample to disk or stdout. Use this to validate a template quickly before generating new content.
html-anything sample travel-flight-deal-xhs -o flight.html
html-anything sample travel-flight-deal-xhs --format md -o input.mdagents
html-anything agentsLists detected local AI agent CLIs and whether each can be used.
export image
html-anything export image <html-file> [options]Renders a local generated HTML file to a PNG using the local Playwright renderer.
| Option | Description |
|--------|-------------|
| --output, -o <path> | Output PNG path; default is <input-name>.png |
| --long | Mobile long-image export: 390px viewport, scale 1, max 30000 CSS pixels |
| --platform <id> | Apply platform image defaults: wechat, xiaohongshu, bilibili, douyin, weibo, zhihu, x, instagram, facebook, linkedin |
| --target <type> | Viewport target: pc, h5, or responsive; default is desktop width |
| --viewport-width <px> | Override screenshot viewport width |
| --scale <n> | Device scale factor; default is 2, or 1 for long images |
| --max-height <px> | Maximum captured CSS height |
| --background <color> | Force page background before capture |
| --json | Print a JSON manifest to stdout after success |
Platform defaults are not all the same. For example, xiaohongshu uses a mobile long-image export, while douyin and instagram use mobile viewport image export, and desktop feed platforms keep the current desktop-style viewport unless overridden.
When a fixed-width page is wider than the export viewport, the renderer auto-scales the page before measuring height. This keeps 1080px H5/card templates from being horizontally cropped when exported as 390px or 430px long images.
config
html-anything config
html-anything config set-default-template <id>
html-anything config set-default-agent <id>
html-anything config set-model <id>
html-anything config resetConfiguration is stored at ~/.config/html-anything/config.json.
Compatibility Commands
convert and auto remain available for existing scripts. New public functionality lands on generate first.
html-anything convert article.md -t doc-kami-parchment
html-anything auto article.mdLocal Execution Model
local input
-> bundled templates
-> local AI agent CLI
-> local HTML file/stdout
-> optional local Playwright PNG exportThere is no hosted mode, no --server flag, and no HTML Anything API dependency.
Development
# Install workspace dependencies
pnpm install --frozen-lockfile
# Run tests
pnpm -F html-anything test
# Typecheck
pnpm -F html-anything typecheck
# Build package output, including bundled templates
pnpm -F html-anything build
# Run the built CLI
node cli/dist/run.js doctor