Fetch web content as clean markdown using Cloudflare's conversion services. Use when fetching URL content where structured markdown is preferred over raw text extraction. Supports content negotiation, Workers AI, and Browser Rendering with automatic fallback.
Fetches web content as clean markdown using a cascading chain of three Cloudflare conversion methods. Produces structured markdown that preserves headings, links, and formatting -- ideal for AI consumption with ~80% fewer tokens than HTML.
No setup needed for basic usage:
python3 scripts/fetch_markdown.py "https://blog.cloudflare.com/markdown-for-agents/"
For full Cloudflare API access (optional): Set environment variables:
CLOUDFLARE_ACCOUNT_ID=your_account_id
CLOUDFLARE_API_TOKEN=your_api_token
Or add to ~/.claude/.env (Claude Code) or the equivalent env file for your platform.
The skill tries three methods in order, stopping at the first success:
| # | Method | Credentials | Best For |
|---|--------|-------------|----------|
| 1 | Content Negotiation (Accept: text/markdown) | None | Cloudflare sites with feature enabled |
| 2 | Workers AI toMarkdown REST API | Required | HTML/PDF/Office docs from any site |
| 3 | Browser Rendering /markdown REST API | Required | JS-heavy SPAs, dynamic pages |
Sends Accept: text/markdown header. If the site is behind Cloudflare with "Markdown for Agents" enabled, it returns markdown directly from the CDN edge.
python3 scripts/fetch_markdown.py "https://blog.cloudflare.com/markdown-for-agents/" --method negotiate
Downloads the file, uploads it to Cloudflare's toMarkdown REST API. The most versatile method -- handles PDFs, Office docs, images, and more.
CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKENpython3 scripts/fetch_markdown.py "https://example.com/report.pdf" --method workers-ai -t 120
Sends the URL to Cloudflare's headless Chromium, which renders the page fully (including JavaScript), then converts to markdown.
CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKENpython3 scripts/fetch_markdown.py "https://spa-app.com" --method browser-rendering
python3 scripts/fetch_markdown.py "https://example.com"
python3 scripts/fetch_markdown.py "https://example.com" -f json
python3 scripts/fetch_markdown.py "https://example.com" --include-metadata
python3 scripts/fetch_markdown.py "https://example.com" --method negotiate
python3 scripts/fetch_markdown.py "https://example.com" --method workers-ai
python3 scripts/fetch_markdown.py "https://spa-app.com" --method browser-rendering
python3 scripts/fetch_markdown.py "https://example.com" -q -f json | jq '.content'
| Option | Description | Default |
|--------|-------------|---------|
| url | Target URL (required) | -- |
| -f, --format | Output format: text, json | text |
| -t, --timeout | Request timeout in seconds | 30 |
| --verify-ssl | Verify SSL certificates | False |
| --method | Force method: auto, negotiate, workers-ai, browser-rendering | auto |
| --no-fallback | Stop after first method attempt | False |
| --include-metadata | Prepend metadata to text output | False |
| -q, --quiet | Suppress stderr status messages | False |
Required: Python 3.6+ (standard library only, zero third-party dependencies)
npx skills add arsolutioner/markdown-for-agents下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer
Tags:markdown, web-fetch, cloudflare, ai-agents, llm-tools