跳到正文
Skillpedia
网页抓取33k · #8812

web-to-markdown

它能做什么

这项技能使用你电脑上的浏览器,把网页转换为整洁的 Markdown 文件。适合想保存或复用通过 JavaScript 加载的文章文本的人。

适用场景

  • ✓当你想把文章或网页保存为整洁的文本文件时。
  • ✓当页面只有在 JavaScript 运行后才显示内容,而简单下载会漏掉内容时。
  • ✓当你想把结果保存到文件或打印出来,而不是粘贴到聊天中的时候。

技能链接

https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/web-to-markdown/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/web-to-markdown/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请用 web-to-markdown 这项技能处理这篇文章的链接,并帮我保存为 Markdown 文件。”

每周 5 个新技能,1 分钟读完。

工作原理

这项技能在你电脑上基于 Chromium 的浏览器中打开页面,提取主要内容,转换为 Markdown,并保存或打印。你也可以自己在浏览器中完成任何登录或验证。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

web-to-markdown

Convert web pages to clean Markdown by driving a locally installed browser (via web2md).

Hard trigger gate (must enforce)

This skill MUST NOT be used unless the user explicitly wrote exactly a phrase like:

  • use the skill web-to-markdown ...
  • use a skill web-to-markdown ...

If the user did not explicitly request this skill by name, stop and ask them to re-issue the request including: use the skill web-to-markdown.

What this skill does

  • Handles JS-rendered pages (Puppeteer → user Chrome).
  • Works best with Chromium-family browsers (Chrome/Chromium/Brave/Edge) via puppeteer-core.
  • Extracts main content (Readability).
  • Converts to Markdown (Turndown) with cleaned links and optional YAML frontmatter.

Non-goals

  • Do not use Playwright or other browser automation stacks; the mechanism is web2md.

Inputs you should collect (ask only if missing)

  • url (or a list of URLs)
  • Output preference:
    • Print to stdout (--print), OR
    • Save to a file (--out ./file.md), OR
    • Save to a directory (--out ./some-dir/ to auto-name by page title)
  • Optional rendering controls for tricky pages:
    • --chrome-path <path> (if Chrome auto-detection fails)
    • --interactive (show Chrome and pause so the user can complete human checks/login, then press Enter)
    • --wait-until load|domcontentloaded|networkidle0|networkidle2
    • --wait-for '<css selector>'
    • --wait-ms <milliseconds>
    • --headful (debug)
    • --no-sandbox (sometimes required in containers/CI)
    • --user-data-dir <dir> (login/session; use a dedicated profile directory)

Workflow

  1. Confirm the user explicitly invoked the skill (use the skill web-to-markdown).
  2. Validate URL(s) start with http:// or https://.
  3. Ensure web2md is installed:
    • Run: command -v web2md
    • If missing, instruct the user to install it:
      • If available via npm: npm install -g web2md
      • If from source: Clone the repository, then run npm install && npm run build && npm link
  4. Convert:
    • Single URL → file:
      • web2md '<url>' --out ./page.md
    • Single URL → auto-named file in directory:
      • mkdir -p ./out && web2md '<url>' --out ./out/
    • Human verification / login walls (interactive):
      • mkdir -p ./out && web2md '<url>' --interactive --user-data-dir ./tmp/web2md-profile --out ./out/
      • Then: complete the check in the browser window and press Enter in the terminal to continue.
    • Print to stdout:
      • web2md '<url>' --print
    • Multiple URLs (batch):
      • Create output dir (e.g. ./out/) then run one web2md command per URL using --out ./out/
  5. Validate output:
    • If writing files, verify they exist and are non-empty (e.g. ls -la <path> and wc -c <path>).
  6. Return:
    • The saved file path(s), or the Markdown (stdout mode).

Defaults (recommended)

  • For most pages: --wait-until networkidle2
  • For heavy apps: start with --wait-until domcontentloaded --wait-ms 2000, then add --wait-for 'main' (or another stable selector) if needed.
常见问题

为什么我需要点名这项技能?

这项技能只有在你明确通过名称要求 web-to-markdown 时才会运行,因此不会自行启动。

它使用哪些浏览器?

它在电脑上安装的 Chrome、Chromium、Brave 或 Edge 等基于 Chromium 的浏览器中效果最好。

它能保存到文件夹吗?

可以。你可以打印结果、保存为文件,或保存到文件夹中,文件名取自网页标题。

详情

作者的原始描述

Use ONLY when the user explicitly says: 'use the skill web-to-markdown ...' (or 'use a skill web-to-markdown ...'). Converts webpage URLs to clean Markdown by calling the local web2md CLI (Puppeteer + Readability), suitable for JS-rendered pages.

repo: davila7/claude-code-templates

热度

GitHub 星标
33k
排名
#8812
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能