The Unreasonable Length of HTML
Description and use
Lede cuts token usage and generation time, producing safe HTML pages from concise prompts.
Problem
Agents produce long Markdown files that are hard to read and lack charts, diagrams, and layout, while HTML can convey these richer artifacts but is token‑heavy.
Outcome
Using Lede reduces output tokens by ~80% compared to raw HTML, cuts generation time from ~84 s to ~12 s per page, and produces safer, reviewable HTML pages.
Workflow
- 1. Write a Lede prompt describing the desired page (e.g., metrics, charts).
- 2. Run the Lede compiler (via npm @lede-lang/cli or Claude plugin).
- 3. The compiler outputs a sanitized HTML page with embedded data and CSP.
- 4. Review the rendered page; if missing features, adjust the Lede prompt and recompile.
Evidence
I had Haiku 5.5, Sonnet 5.5 and Opus 5.5 each write 60 pages twice from the same briefs, once as HTML and once as Lede, and counted output tokens with each model's own tokenizer.
The compiler turns it into a 44 KB page with a title block, three metric tiles, a line chart with a dashed target and an event marker, a note, light and dark themes, a phone layout, and no script tag.
Lede has no way to say either. The compiler sanitizes its one escape hatch for raw HTML, refuses remote images unless asked, and writes a content security policy into every page.
- Record date: 2026-10-27T23:11:13.327Z