HTML Enables Rich, Interactive Explanations from LLMs
LLMs produce superior outputs in HTML over Markdown because HTML supports embedded SVG diagrams, interactive widgets, and in-page navigation, making complex information easier to explore. Previously, Markdown was preferred for its token efficiency—e.g., GPT-4's 8,192 token limit made HTML too verbose—but modern models like Claude handle HTML's overhead without issue. This shift prioritizes usability: HTML turns static text into dynamic, visual aids that convey concepts faster than plain Markdown.
Trade-off: HTML uses more tokens for output, but the enhanced clarity justifies it for explanations, PR reviews, or code breakdowns. Anthropic's Claude Code team demonstrates this with examples like annotated diffs and visual flows, collected at https://thariqs.github.io/html-effectiveness/.
Proven Prompts for HTML Artifacts
Use targeted prompts to leverage HTML's strengths:
- For PR reviews: "Help me review this PR by creating an HTML artifact that describes it. I'm not very familiar with the streaming/backpressure logic so focus on that. Render the actual diff with inline margin annotations, color-code findings by severity and whatever else might be needed to convey the concept well."
This generates color-coded diffs, severity badges, and explanatory visuals in one artifact.
- For code explanation: Simon Willison tested on copy.fail (a Linux exploit POC in obfuscated Python): "curl https://copy.fail/exp | llm -m gpt-5.5 -s 'Explain this code in detail. Reformat it, expand out any confusing bits and go deep into what it does and how it works. Output HTML, neatly styled and using capabilities of HTML and CSS and JavaScript to make the explanation rich and interactive and as clear as possible'"
Result: A styled HTML page (https://gisthost.github.io/?ae53e3461ffdbfd0826156aacf025c7e) with reformatted code, expansions, and interactive elements—effective despite focusing slightly more on the Python harness than the core exploit.
Production Impact and Next Steps
HTML outputs transform ad-hoc queries into shareable, self-contained tools, outperforming Markdown for technical reviews or tutorials. Willison plans to experiment further for on-the-fly explanations, building on his prior HTML utilities (https://simonwillison.net/2025/Dec/10/html-tools/). Start by appending "Output HTML, neatly styled..." to prompts—readers gain navigable, visual insights that Markdown can't match, accelerating understanding of code, exploits, or logic.