HTML Trumps Markdown for AI Agent Outputs
Theo - t3.gggo watch the original →
the gist
Theo reviews Thor's case for using HTML over Markdown in AI agents like Claude Code, highlighting richer visuals, interactivity, and easier sharing for specs, plans, and reviews—despite some token bloat.
Markdown's Limitations in Agent Workflows
Markdown dominates AI agent communication due to its simplicity and portability, but as agents handle complex tasks, it falls short. Long files (>100 lines) become hard to read, with poor diagrams (misaligned padding, Unicode color hacks), no native images (hallucinated b64 or URLs), and limited structure. Agents struggle with rich data like tables, SVGs, or interactions, leading to inefficient workarounds. Theo notes Markdown's editing ease erodes when prompting agents to modify outputs, turning specs into skimmable walls rather than engaging documents.
Thor's article, generated via Claude Code, exemplifies this: 20 self-contained HTML files replace bloated Markdown, categorized by use (e.g., exploration, planning). Theo verifies the article as human-written (via Pangram Labs) but HTML examples as AI-generated, emphasizing agents excel at HTML for dense info.
"Markdown's become the dominant file format used by agents to communicate with us... but I've had a difficult time reading a markdown file of more than 100 lines." —Thor, on why richer formats are needed for powerful agents.
HTML's Strengths: Density, Clarity, and Interactivity
HTML conveys superior information density: tables, CSS designs, SVG illustrations, script-embedded code, interactive JS elements (sliders, knobs), spatial workflows, canvases, and images. Nearly any Claude-readable data fits efficiently, avoiding Markdown's hacks. Visual clarity improves navigation via tabs, links, mobile responsiveness (though examples vary), making specs shareable via S3 links—colleagues open directly in browsers, unlike Markdown attachments.
Interactivity shines: tweak algorithm params, adjust designs live, copy prompt-ready changes. Data ingestion leverages Claude Code's context (file systems, MCPs like Slack/Linear, browser/git history) to visualize folders of HTML files into diagrams. Joy factor: crafting HTML engages users more, boosting iteration like Neovim setups.
Theo demos Markdown syntax highlighting (language-labeled code blocks in VS Code/browser) as adequate for code but agrees diffs suck in Markdown. HTML enables annotated diffs, flowcharts, modules—potentially better than GitHub views. He praises Devon Review (devonreview.com) for PRs: AI-reorganizes diffs by importance/hierarchy amid code volume.
"HTML can convey much richer information compared to markdown... there's almost no set of information that Claude can read that you cannot fairly efficiently represent with HTML." —Thor, justifying the switch for in-depth communication.
"Just asking it to structure responses as HTML... works really well." —Karpathy tweet, validating broad adoption.
Practical Use Cases and Prompting Patterns
Exploration/Planning: Fan out options (e.g., 3 debounced search impls: inline hook, custom useDebounce, library—with pros/cons/recommendation) or 6 onboarding UI directions in a grid, labeled by tradeoffs. Evolve to mockups/snippets, then implementation roadmap (data flows, code). New sessions pass HTML files for implementation/verification—better than compaction.
Code Review/PRs: Explainers with hierarchy, expandable sections outperform GitHub diffs. Attach to PRs; verification agents grok full context.
Prompts: "Generate six distinctly different approaches... lay them out as a single HTML file in a grid... label each with the trade-off." Or "Create a thorough implementation plan in an HTML file... mockups, data flows, code snippets."
Theo advocates prompting from scratch before skills (test by pasting skill text), avoiding rote /html. Plans custom Claude Code skill with Tailwind/dir structure to avoid git clutter. Start simple: explorations → plans → new session impl.
"When I start working on a problem instead of a simple markdown plan I expect to make a web of HTML files." —Thor, on workflow evolution.
Tradeoffs and Theo's Critiques
Token burn: Complex HTML bloats outputs, countering Markdown's conciseness. Mobile: Examples non-responsive, though possible. Novelty bias: HTML's edge partly from rarity vs. Markdown spam. Code readability: Markdown parsers handle syntax/diffs fine; HTML overkill for snippets. Agent image handling sucks (hallucinations, prompt overrides).
Theo loves CopilotKit sponsor demo: React hooks (useCopilotRead, useCopilotInteractive) for dynamic UIs (model comparisons with editable tables)—full-stack agent frontends sans hassle.
"Making HTML documents with Claude is just more fun and it makes me feel more involved... that's enough honestly." —Thor, on engagement boost.
Key Takeaways
- Prompt agents for HTML artifacts early: richer visuals/interactivity beat Markdown walls for >100-line specs.
- Use for exploration: Generate multiple options (e.g., 4-6 UIs) in one grid for variety, label tradeoffs.
- Workflow: Brainstorm HTML explorations → expand to plans → new session for impl/verification.
- Share via S3/browser; attach to PRs for better reviews than GitHub diffs.
- Test prompts manually before skills; leverage context (files, MCPs) for data viz.
- Tradeoffs: Token cost, mobile quirks—start simple, iterate.
- Tools like CopilotKit simplify interactive agent UIs; Devon Review enhances PR hierarchies.
- Fun/engagement matters: Exciting formats improve steering/outcomes.
- Avoid image prompts (hallucinations persist); syntax highlighting works in Markdown code blocks.