SuperAPI AI 工具集

readable-mdn

写作与研究

查看项目

更新于 10-16 07:18

技能介绍

用途:MDN Web Docs 的内容本身以 Markdown 形式存放在 GitHub 上,本技能通过把 developer.mozilla.org 的文档 URL 映射到对应源码仓库路径,直接抓取原始 Markdown,避免解析单页应用页面,内容更紧凑、便于阅读与引用。

主要能力:

  • 英文(en-US)映射到 mdn/content 仓库。
  • 其他语言(ja、fr、zh-CN 等)映射到 mdn/translated-content 仓库。
  • 支持在原始 URL 发生重定向时,先用 curl -IL 解析后再映射。

使用方式:

  1. 把 https://developer.mozilla.org/{locale}/docs/{path} 映射为源码路径。 英文:https://raw.githubusercontent.com/mdn/content/main/files/en-us/{path-lowercased}/index.md 其他语言:https://raw.githubusercontent.com/mdn/translated-content/main/files/{locale-lowercased}/{path-lowercased}/index.md
  2. 抓取 Markdown,例如: curl -s -o /tmp/mdn.md "https://raw.githubusercontent.com/mdn/content/main/files/en-us/{path}/index.md" 翻译内容: curl -s -o /tmp/mdn.md "https://raw.githubusercontent.com/mdn/translated-content/main/files/{locale}/{path}/index.md"
  3. 读取 /tmp/mdn.md。若路径错误返回 404,回退到对原始 developer.mozilla.org URL 使用 WebFetch。

适用场景:需要以简洁 Markdown 形式获取 MDN 文档内容、进行引用或后续处理时。

限制与许可:MDN 内容为双许可,正文为 CC BY-SA 2.5,代码示例为 CC0;引用时应链接回对应 MDN 页面。

参考:

  • mdn/content:https://github.com/mdn/content
  • mdn/translated-content:https://github.com/mdn/translated-content
  • 许可:https://github.com/mdn/content/blob/main/LICENSE.md