baoyu-url-to-markdown

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

URL 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
scripts/
subdirectory of this skill.
Agent Execution Instructions:
  1. Determine this SKILL.md file's directory path as
    SKILL_DIR
  2. Script path =
    ${SKILL_DIR}/scripts/<script-name>.ts
  3. Replace all
    ${SKILL_DIR}
    in this document with the actual path
Script Reference:
ScriptPurpose
scripts/main.ts
CLI entry point for URL fetching
重要提示:所有脚本都位于此skill的
scripts/
子目录中。
Agent执行说明:
  1. 将此SKILL.md文件的目录路径确定为
    SKILL_DIR
  2. 脚本路径 =
    ${SKILL_DIR}/scripts/<script-name>.ts
  3. 将本文档中所有
    ${SKILL_DIR}
    替换为实际路径
脚本参考:
脚本用途
scripts/main.ts
URL获取的CLI入口点

Preferences (EXTEND.md)

偏好设置(EXTEND.md)

Use Bash to check EXTEND.md existence (priority order):
bash
undefined
使用Bash检查EXTEND.md是否存在(优先级顺序):
bash
undefined

Check 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 settings
test -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
undefined
bash
undefined

Auto 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
undefined
npx -y bun ${SKILL_DIR}/scripts/main.ts <url> -o output.md
undefined

Options

选项参数

OptionDescription
<url>
URL to fetch
-o <path>
Output file path (default: auto-generated)
--wait
Wait for user signal before capturing
--timeout <ms>
Page load timeout (default: 30000)
选项描述
<url>
要获取的URL
-o <path>
输出文件路径(默认:自动生成)
--wait
捕获前等待用户信号
--timeout <ms>
页面加载超时时间(默认:30000)

Capture Modes

捕获模式

ModeBehaviorUse When
Auto (default)Capture on network idlePublic pages, static content
Wait (
--wait
)
User signals when readyLogin-required, lazy loading, paywalls
Wait mode workflow:
  1. Run with
    --wait
    → script outputs "Press Enter when ready"
  2. Ask user to confirm page is ready
  3. Send newline to stdin to trigger capture
模式行为适用场景
自动(默认)网络空闲时捕获公共页面、静态内容
等待(
--wait
用户触发时捕获需要登录、懒加载、付费墙页面
等待模式工作流程:
  1. 使用
    --wait
    参数运行 → 脚本输出"准备就绪后按回车键"
  2. 请用户确认页面已准备完毕
  3. 向标准输入发送换行符以触发捕获

Output Format

输出格式

YAML front matter with
url
,
title
,
description
,
author
,
published
,
captured_at
fields, followed by converted markdown content.
包含
url
title
description
author
published
captured_at
字段的YAML前置元数据,随后是转换后的Markdown内容。

Output Directory

输出目录

url-to-markdown/<domain>/<slug>.md
  • <slug>
    : From page title or URL path (kebab-case, 2-6 words)
  • Conflict resolution: Append timestamp
    <slug>-YYYYMMDD-HHMMSS.md
url-to-markdown/<domain>/<slug>.md
  • <slug>
    :源自页面标题或URL路径(短横线分隔格式,2-6个单词)
  • 冲突解决:追加时间戳
    <slug>-YYYYMMDD-HHMMSS.md

Environment Variables

环境变量

VariableDescription
URL_CHROME_PATH
Custom Chrome executable path
URL_DATA_DIR
Custom data directory
URL_CHROME_PROFILE_DIR
Custom Chrome profile directory
Troubleshooting: Chrome not found → set
URL_CHROME_PATH
. Timeout → increase
--timeout
. Complex pages → try
--wait
mode.
变量描述
URL_CHROME_PATH
自定义Chrome可执行文件路径
URL_DATA_DIR
自定义数据目录
URL_CHROME_PROFILE_DIR
自定义Chrome配置文件目录
故障排除:未找到Chrome → 设置
URL_CHROME_PATH
。超时 → 增加
--timeout
值。复杂页面 → 尝试使用
--wait
模式。

Extension Support

扩展支持

Custom configurations via EXTEND.md. See Preferences section for paths and supported options.
通过EXTEND.md进行自定义配置。有关路径和支持的选项,请参阅偏好设置部分。