News

Claude Code团队揭示HTML在AI输出中的“惊人”潜力

Claude Code团队揭示HTML在AI输出中的“惊人”潜力

Anthropic Claude Code团队的Thariq Shihipar近日发表了一篇引人深思的文章,主张将HTML而非Markdown作为请求Claude输出的首选格式。他认为,HTML在AI生成内容方面展现出“惊人的有效性”。

文章中充满了有趣的示例和提示建议,例如以下这条:

"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."

自GPT-4时代以来,由于其8,192个token的限制,Markdown相比HTML在token效率上具有显著优势,因此作者通常默认要求AI以Markdown格式输出。然而,Thariq的这篇文章促使作者重新审视这一习惯,尤其是在输出内容方面。通过要求Claude以HTML格式提供解释,AI能够嵌入SVG图表、交互式小部件、页面内导航以及各种其他巧妙的方式,使信息呈现更具可读性和吸引力。

作者去年曾撰写过一篇关于“构建HTML工具的实用模式”的文章,但那篇文章主要侧重于像其tools.simonwillison.net网站上的交互式实用工具。现在,作者表示很期待能更多地尝试利用富HTML格式,根据临时提示生成丰富的解释内容。

为了验证这一想法,作者在copy.fail网站上进行了尝试。该网站描述了一个最近发现的Linux安全漏洞,并提供了一个以混淆Python形式分发的概念验证代码。作者尝试让GPT-5.5创建一个关于该漏洞的HTML解释,使用了如下命令:

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页面效果相当不错。尽管作者认为,如果能更侧重于解释漏洞本身而非其周围的Python封装,效果会更好,但这已经展现了HTML在AI解释能力上的巨大潜力。

↗ 阅读原文