AIHTMLMarkdownClaudePrompt Engineering

HTML 的不合理有效性——为什么 AI 输出应该选择 HTML 而非 Markdown

Simon Willison / Thariq Shihipar··原文链接
收录于 2026/5/17 22:34:06

核心观点

长期以来,开发者习惯让 AI 输出 Markdown 格式,因为在 GPT-4 时代(8k token 限制),Markdown 的 token 效率远高于 HTML。但 Anthropic Claude Code 团队的 Thariq Shihipar 提出 reconsideration:对于输出而言,HTML 是更好的选择。

为什么 HTML 优于 Markdown

1. 丰富的表达能力

  • SVG 图表和可视化
  • 交互式组件
  • 页内导航
  • 样式丰富、结构清晰

2. 实际提示示例

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.

实战验证:copy.fail 漏洞分析

Simon 使用 GPT-5.5 分析 copy.fail 的 Linux 安全漏洞:

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'

生成的 HTML 页面 成功实现了:

  • 代码高亮和格式化
  • 交互式元素
  • 结构化的漏洞分析

结论

HTML 作为 AI 输出格式的优势在于其丰富的表达能力。随着 token 成本不断降低,Markdown 的 token 效率优势已不再重要,而 HTML 能提供的丰富交互体验才是未来方向。

参考资源