url-to-markdown
Original:🇺🇸 English
Translated
5 scripts
Fetch any URL and convert to markdown using Chrome CDP. Supports two modes - auto-capture on page load, or wait for user signal (for pages requiring login). Use when user wants to save a webpage as markdown.
6installs
Sourcezlh-428/naruto-skills
Added on
NPX Install
npx skill4agent add zlh-428/naruto-skills url-to-markdownTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →URL to Markdown
Fetches any URL via Chrome CDP and converts HTML to clean markdown.
Script Directory
Important: All scripts are located in 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 actual path
${SKILL_DIR}
Script Reference:
| Script | Purpose |
|---|---|
| CLI entry point for URL fetching |
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
Usage
bash
# Auto mode (default) - capture when page loads
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
# Save to specific file
npx -y bun ${SKILL_DIR}/scripts/main.ts <url> -o output.mdOptions
| Option | Description |
|---|---|
| URL to fetch |
| Output file path (default: auto-generated) |
| Wait for user signal before capturing |
| Page load timeout (default: 30000) |
Capture Modes
Auto Mode (default)
Page loads → waits for network idle → captures immediately.
Best for:
- Public pages
- Static content
- No login required
Wait Mode (--wait
)
--waitPage opens → user can interact (login, scroll, etc.) → user signals ready → captures.
Best for:
- Login-required pages
- Dynamic content needing interaction
- Pages with lazy loading
Agent workflow for wait mode:
- Run script with flag
--wait - Script outputs:
Page opened. Press Enter when ready to capture... - Use to ask user if page is ready
AskUserQuestion - When user confirms, send newline to stdin to trigger capture
Output Format
markdown
---
url: https://example.com/page
title: "Page Title"
description: "Meta description if available"
author: "Author if available"
published: "2024-01-01"
captured_at: "2024-01-15T10:30:00Z"
---
# Page Title
Converted markdown content...Mode Selection Guide
When user requests URL capture, help select appropriate mode:
Suggest Auto Mode when:
- URL is public (no login wall visible)
- Content appears static
- User doesn't mention login requirements
Suggest Wait Mode when:
- User mentions needing to log in
- Site known to require authentication
- User wants to scroll/interact before capture
- Content is behind paywall
Ask user when unclear:
The page may require login or interaction before capturing.
Which mode should I use?
1. Auto - Capture immediately when loaded
2. Wait - Wait for you to interact firstOutput Directory
Each capture creates a file organized by domain:
url-to-markdown/
└── <domain>/
└── <slug>.mdPath Components:
- : Site domain (e.g.,
<domain>,example.com)github.com - : Generated from page title or URL path (kebab-case)
<slug>
Slug Generation:
- Extract from page title (preferred) or URL path
- Convert to kebab-case, 2-6 words
- Example: "Getting Started with React" →
getting-started-with-react
Conflict Resolution:
If already exists:
url-to-markdown/<domain>/<slug>.md- Append timestamp:
<slug>-YYYYMMDD-HHMMSS.md - Example: exists →
getting-started.mdgetting-started-20260118-143052.md
Error Handling
| Error | Resolution |
|---|---|
| Chrome not found | Install Chrome or set |
| Page timeout | Increase |
| Capture failed | Try wait mode for complex pages |
| Empty content | Page may need JS rendering time |
Environment Variables
| Variable | Description |
|---|---|
| Custom Chrome executable path |
| Custom data directory |
| Custom Chrome profile directory |
Extension Support
Custom configurations via EXTEND.md.
Check paths (priority order):
- (project)
.content-gen-skills/url-to-markdown/EXTEND.md - (user)
~/.content-gen-skills/url-to-markdown/EXTEND.md
If found, load before workflow. Extension content overrides defaults.