360 Secure SkillHub
360 安全技能中心

cf markdown agents

核心功能:通过Cloudflare的Markdown for Agents协议抓取网页,将HTML转为结构化Markdown,减少约80%token,返回含token数、AI使用权限的响应头。典型场景:AI处理、网页抓取、内容提取,或用户提及相关协议/格式需求。支持通过脚本、TS/JS、cURL等方式输入URL,输出为Markdown内容及相关响应头。

xinian5216
xinian5216
热度 50.68
最近更新 2026-05-11 17:31:20
分类:效率依赖:第三方 API / 代码执行 / 联网浏览搜索应用场景:文件转换 / 数据处理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add cf-markdown-agents
Metadata
name
cf-markdown-agents
description
Fetch web content using Cloudflare's Markdown for Agents protocol. Automatically converts HTML to Markdown with 80% token reduction. Use when fetching web pages for AI processing, web scraping, content extraction, or when the user mentions "Markdown for Agents", "cf-markdown", or needs structured web content in Markdown format.

Cloudflare Markdown for Agents

This skill enables fetching web content using Cloudflare's Markdown for Agents protocol, which automatically converts HTML pages to clean, structured Markdown format.

What is Markdown for Agents?

Cloudflare's Markdown for Agents is a content negotiation feature that:

  • Automatically converts HTML to Markdown at the edge
  • Reduces token usage by ~80% compared to raw HTML
  • Returns clean, structured content perfect for AI processing
  • Adds x-markdown-tokens header showing estimated token count
  • Includes Content-Signal headers for AI usage permissions

Usage

Basic Fetch

Use the provided script to fetch any URL with Markdown for Agents support:

scripts/fetch-markdown.sh <URL>

Example:

scripts/fetch-markdown.sh "https://developers.cloudflare.com/agents/"

In Code

TypeScript/JavaScript example:

const response = await fetch("https://example.com/page", {
  headers: {
    Accept: "text/markdown, text/html",
  },
});

const tokenCount = response.headers.get("x-markdown-tokens");
const markdown = await response.text();

cURL example:

curl https://example.com/page -H "Accept: text/markdown"

Response Headers

  • content-type: text/markdown; charset=utf-8 - Content is Markdown
  • x-markdown-tokens: <number> - Estimated token count
  • content-signal: ai-train=yes, search=yes, ai-input=yes - Usage permissions

Supported Sites

Any site using Cloudflare with Markdown for Agents enabled:

  • Cloudflare Developer Documentation (developers.cloudflare.com)
  • Cloudflare Blog (blog.cloudflare.com)
  • Any site with the feature enabled in Cloudflare dashboard

Benefits

Aspect HTML Markdown
Tokens 16,180 3,150
Reduction - ~80%
Structure Complex Clean
AI Parsing Hard Easy

References