baoyu-url-to-markdown
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseURL to Markdown
URL 转 Markdown
Fetches any URL via Chrome CDP and converts HTML to clean markdown.
通过Chrome CDP获取任意URL并将HTML转换为整洁的Markdown格式。
Script Directory
脚本目录
Important: All scripts are located in the subdirectory of this skill.
scripts/Agent Execution Instructions:
- Determine this SKILL.md file's directory path as
SKILL_DIR - Script path =
${SKILL_DIR}/scripts/<script-name>.ts - Replace all in this document with the actual path
${SKILL_DIR}
Script Reference:
| Script | Purpose |
|---|---|
| CLI entry point for URL fetching |
重要提示:所有脚本都位于此skill的子目录中。
scripts/Agent执行说明:
- 将此SKILL.md文件的目录路径确定为
SKILL_DIR - 脚本路径 =
${SKILL_DIR}/scripts/<script-name>.ts - 将本文档中所有替换为实际路径
${SKILL_DIR}
脚本参考:
| 脚本 | 用途 |
|---|---|
| URL获取的CLI入口点 |
Preferences (EXTEND.md)
偏好设置(EXTEND.md)
Use Bash to check EXTEND.md existence (priority order):
bash
undefined使用Bash检查EXTEND.md是否存在(优先级顺序):
bash
undefinedCheck project-level first
首先检查项目级
test -f .baoyu-skills/baoyu-url-to-markdown/EXTEND.md && echo "project"
test -f .baoyu-skills/baoyu-url-to-markdown/EXTEND.md && echo "project"
Then user-level (cross-platform: $HOME works on macOS/Linux/WSL)
然后检查用户级(跨平台:$HOME 在 macOS/Linux/WSL 上均可使用)
test -f "$HOME/.baoyu-skills/baoyu-url-to-markdown/EXTEND.md" && echo "user"
┌────────────────────────────────────────────────────────┬───────────────────┐
│ Path │ Location │
├────────────────────────────────────────────────────────┼───────────────────┤
│ .baoyu-skills/baoyu-url-to-markdown/EXTEND.md │ Project directory │
├────────────────────────────────────────────────────────┼───────────────────┤
│ $HOME/.baoyu-skills/baoyu-url-to-markdown/EXTEND.md │ User home │
└────────────────────────────────────────────────────────┴───────────────────┘
┌───────────┬───────────────────────────────────────────────────────────────────────────┐
│ Result │ Action │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ Found │ Read, parse, apply settings │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ Not found │ Use defaults │
└───────────┴───────────────────────────────────────────────────────────────────────────┘
**EXTEND.md Supports**: Default output directory | Default capture mode | Timeout settingstest -f "$HOME/.baoyu-skills/baoyu-url-to-markdown/EXTEND.md" && echo "user"
┌────────────────────────────────────────────────────────┬───────────────────┐
│ 路径 │ 位置 │
├────────────────────────────────────────────────────────┼───────────────────┤
│ .baoyu-skills/baoyu-url-to-markdown/EXTEND.md │ 项目目录 │
├────────────────────────────────────────────────────────┼───────────────────┤
│ $HOME/.baoyu-skills/baoyu-url-to-markdown/EXTEND.md │ 用户主目录 │
└────────────────────────────────────────────────────────┴───────────────────┘
┌───────────┬───────────────────────────────────────────────────────────────────────────┐
│ 结果 │ 操作 │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ 找到 │ 读取、解析并应用设置 │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ 未找到 │ 使用默认设置 │
└───────────┴───────────────────────────────────────────────────────────────────────────┘
**EXTEND.md支持**:默认输出目录 | 默认捕获模式 | 超时设置Features
功能特性
- Chrome CDP for full JavaScript rendering
- Two capture modes: auto or wait-for-user
- Clean markdown output with metadata
- Handles login-required pages via wait mode
- 采用Chrome CDP实现完整JavaScript渲染
- 两种捕获模式:自动或等待用户触发
- 包含元数据的整洁Markdown输出
- 通过等待模式处理需要登录的页面
Usage
使用方法
bash
undefinedbash
undefinedAuto mode (default) - capture when page loads
自动模式(默认)- 页面加载完成时捕获
npx -y bun ${SKILL_DIR}/scripts/main.ts <url>
npx -y bun ${SKILL_DIR}/scripts/main.ts <url>
Wait mode - wait for user signal before capture
等待模式 - 捕获前等待用户信号
npx -y bun ${SKILL_DIR}/scripts/main.ts <url> --wait
npx -y bun ${SKILL_DIR}/scripts/main.ts <url> --wait
Save to specific file
保存到指定文件
npx -y bun ${SKILL_DIR}/scripts/main.ts <url> -o output.md
undefinednpx -y bun ${SKILL_DIR}/scripts/main.ts <url> -o output.md
undefinedOptions
选项参数
| Option | Description |
|---|---|
| URL to fetch |
| Output file path (default: auto-generated) |
| Wait for user signal before capturing |
| Page load timeout (default: 30000) |
| 选项 | 描述 |
|---|---|
| 要获取的URL |
| 输出文件路径(默认:自动生成) |
| 捕获前等待用户信号 |
| 页面加载超时时间(默认:30000) |
Capture Modes
捕获模式
| Mode | Behavior | Use When |
|---|---|---|
| Auto (default) | Capture on network idle | Public pages, static content |
Wait ( | User signals when ready | Login-required, lazy loading, paywalls |
Wait mode workflow:
- Run with → script outputs "Press Enter when ready"
--wait - Ask user to confirm page is ready
- Send newline to stdin to trigger capture
| 模式 | 行为 | 适用场景 |
|---|---|---|
| 自动(默认) | 网络空闲时捕获 | 公共页面、静态内容 |
等待( | 用户触发时捕获 | 需要登录、懒加载、付费墙页面 |
等待模式工作流程:
- 使用参数运行 → 脚本输出"准备就绪后按回车键"
--wait - 请用户确认页面已准备完毕
- 向标准输入发送换行符以触发捕获
Output Format
输出格式
YAML front matter with , , , , , fields, followed by converted markdown content.
urltitledescriptionauthorpublishedcaptured_at包含、、、、、字段的YAML前置元数据,随后是转换后的Markdown内容。
urltitledescriptionauthorpublishedcaptured_atOutput Directory
输出目录
url-to-markdown/<domain>/<slug>.md- : From page title or URL path (kebab-case, 2-6 words)
<slug> - Conflict resolution: Append timestamp
<slug>-YYYYMMDD-HHMMSS.md
url-to-markdown/<domain>/<slug>.md- :源自页面标题或URL路径(短横线分隔格式,2-6个单词)
<slug> - 冲突解决:追加时间戳
<slug>-YYYYMMDD-HHMMSS.md
Environment Variables
环境变量
| Variable | Description |
|---|---|
| Custom Chrome executable path |
| Custom data directory |
| Custom Chrome profile directory |
Troubleshooting: Chrome not found → set . Timeout → increase . Complex pages → try mode.
URL_CHROME_PATH--timeout--wait| 变量 | 描述 |
|---|---|
| 自定义Chrome可执行文件路径 |
| 自定义数据目录 |
| 自定义Chrome配置文件目录 |
故障排除:未找到Chrome → 设置。超时 → 增加值。复杂页面 → 尝试使用模式。
URL_CHROME_PATH--timeout--waitExtension Support
扩展支持
Custom configurations via EXTEND.md. See Preferences section for paths and supported options.
通过EXTEND.md进行自定义配置。有关路径和支持的选项,请参阅偏好设置部分。