GPT-5.5 构建的 GitHub 代码嵌入 Web 组件

github-code Web Component

精选理由

Simon Willison 用 GPT-5.5 写了这个 Web 组件,能自动从 GitHub 链接抓取指定行的代码显示在网页上,带行号,做文档或博客嵌入代码很方便。

AI 摘要

Simon Willison 使用 GPT-5.5 创建了实验性 Web 组件 github-code,仅通过一个提示词构建。该组件接受类似 https://github.com/simonw/sqlite-ast/blob/437c759... 的 URL,自动转换为 https://raw.githubusercontent.com/... 路径,然后用 fetch() 获取并显示指定行范围(如 #L9-L18),带行号但不支持语法高亮。它可直接嵌入网页展示代码片段。

AI 翻译 · 中文

Simon Willison 使用 GPT-5.5 创建了实验性 Web 组件 github-code,仅通过一个提示词构建。该组件接受类似 https://github.com/simonw/sqlite-ast/blob/437c759... 的 URL,自动转换为 https://raw.githubusercontent.com/... 路径,然后用 fetch() 获取并显示指定行范围(如 #L9-L18),带行号但不支持语法高亮。它可直接嵌入网页展示代码片段。

Simon Willison’s WeblogTool: github-code Web Component An experimental Web Component built using GPT-5.5 and the following prompt : let's build a Web Component for embedding code from GitHub <github-code href="https://github.com/simonw/sqli
GPT-5.5 构建的 GitHub 代码嵌入 Web 组件 · AI 热点