← all news

Ask Claude for HTML instead of Markdown and the explanation gets better

Engineering · · 1 week ago · source (simonwillison.net)

Simon Willison's post passes along a small habit from Thariq Shihipar on Anthropic's Claude Code team that changes the quality of an answer for almost no effort: ask for the explanation as HTML rather than Markdown. Once the model is allowed to write HTML, it can drop in SVG diagrams, collapsible sections, in-page navigation, and small interactive widgets, none of which Markdown can carry. The token cost that made this wasteful during the short-context GPT-4 era is no longer a real constraint.

The example is what sells it. Willison piped a Linux security exploit into Claude and asked for a richly styled, interactive HTML explanation. What came back had color-coded severity levels, sections you could expand, and inline annotations, which is far more usable for understanding an exploit than a flat block of Markdown. The prompt was nothing clever; it just told the model to use HTML, CSS, and JavaScript to make the explanation clear.

It is a one-line change to how you prompt, with an unusually good return.

Why it matters

If you use models to understand code or data, switching your default output to HTML is close to free and immediately more readable: try it on your next "explain this" prompt before reaching for longer explanations.

Claude CodeAnthropic