markdown-new: 适用于 AI 的 URL 转 Markdown 转换器 - Openclaw Skills

作者:袖梨 2026-08-18

什么是 markdown-new?

markdown-new 技能在原始网络和 AI 原生工作流之间架起了一座坚实的桥梁。通过与 markdown.new 服务集成,此 Openclaw Skills 扩展使开发人员能够将复杂的、重度依赖 JavaScript 的网页转换为结构化的 Markdown 文本。这一过程对于降低大语言模型提示词中的 token 成本,以及通过去除不必要的 HTML 噪音和样板内容来提高检索增强生成 (RAG) 系统的准确性至关重要。

该技能专为速度和灵活性而构建,可处理从简单的博客文章到复杂的单页应用程序的所有内容。它提供对渲染方法的细粒度控制,允许开发人员在标准转换、AI 增强提取或完整的无头浏览器渲染之间进行选择。这确保了生成的数据始终保持高质量,并可立即用于 Openclaw Skills 自动化流水线。

下载入口:https://github.com/openclaw/skills/tree/main/skills/joelchance/markdown-convert

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install markdown-convert

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 <project>/skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 markdown-convert。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

markdown-new 应用场景

  • 准备网页文档,以便将其摄取到本地向量数据库和 RAG 流水线中。
  • 为研究代理自动汇总行业新闻和技术文章。
  • 通过将臃肿的 HTML 转换为密集的 Markdown,减少 LLM 提示词的 token 使用量。
  • 从标准爬虫通常无法抓取的 JS 渲染网站中抓取内容。
markdown-new 工作原理
  1. 用户提供一个公开 URL,通过命令行或脚本由该技能进行处理。
  2. 系统验证 URL 并确定最佳转换方法,默认从 auto 设置开始。
  3. 如果内容需要 JavaScript 渲染才能显示,该技能将使用 browser 方法重新运行以进行完整的无头渲染。
  4. 根据 AI 任务是否需要视觉上下文,应用图像保留等可选参数。
  5. 该技能获取内容并返回标准化的 Markdown 输出,以及 token 计数和速率限制状态等关键元数据。

markdown-new 配置指南

要开始使用此 Openclaw Skills 扩展,请确保已安装 Python 3,并导航到技能目录以执行抓取程序。

# 导航到技能根目录以确保正确的路径解析
cd ~/.codex/skills/markdown-new

# 测试基本抓取以验证安装和连接性
python3 scripts/markdown_new_fetch.py 'https://example.com'

markdown-new 数据架构与分类体系

该技能将其输出组织成干净的 Markdown 文件,并捕获响应元数据,以协助规划下游 AI 任务。

属性 描述
x-markdown-tokens 提供所用 token 的估计值,帮助管理 AI 上下文窗口。
x-rate-limit-remaining 跟踪每日 API 使用情况(500 次请求/天),以防止工作流中断。
method 指示转换使用的是 auto、ai 还是 browser 渲染。
--deliver-md 将内容包裹在自定义 XML 风格的标签中,以便编码代理进行结构化解析。
name: markdown-new
description: "Convert public web pages into clean Markdown with markdown.new for AI workflows. Use when tasks require URL-to-Markdown conversion for summarization, RAG ingestion, extraction, archiving, or token reduction, including selecting conversion method (auto/ai/browser), enabling image retention, and handling rate limits or conversion failures."

Markdown.new

Use this skill to convert public URLs into LLM-ready Markdown via markdown.new.

Path Resolution (Critical)

  • Resolve relative paths like scripts/... and references/... from the skill directory, not workspace root.
  • If current directory is unknown, use an absolute script path.
python3 ~/.codex/skills/markdown-new/scripts/markdown_new_fetch.py 'https://example.com'
cd ~/.codex/skills/markdown-new
python3 scripts/markdown_new_fetch.py 'https://example.com'

Avoid this pattern from an arbitrary workspace root:

python3 scripts/markdown_new_fetch.py 'https://example.com'

Workflow

  1. Validate the input URL is public http or https.
  2. Run scripts/markdown_new_fetch.py with --method auto first.
  3. Re-run with --method browser if output misses JS-rendered content.
  4. Enable --retain-images only when image links are required.
  5. Capture response metadata (x-markdown-tokens, x-rate-limit-remaining, and JSON metadata when present) for downstream planning.

Quick Start

Commands below assume current directory is the skill root (~/.codex/skills/markdown-new).

python3 scripts/markdown_new_fetch.py 'https://example.com' > page.md
python3 scripts/markdown_new_fetch.py 'https://example.com' --method browser --retain-images --output page.md
python3 scripts/markdown_new_fetch.py 'https://example.com' --deliver-md

Method Selection

  • auto: default. Let markdown.new use its fastest successful pipeline.
  • ai: force Workers AI HTML-to-Markdown conversion.
  • browser: force headless browser rendering for JS-heavy pages.

Use auto first, then retry with browser only when needed.

Delivery Mode

  • Use --deliver-md to force file output in .md format.
  • In delivery mode, content is wrapped as:
    • <url>
    • ...markdown...
    • </url>
  • If --output is omitted, the script auto-generates a filename from the URL.

API Modes

  • Prefix mode:
    • https://markdown.new/https://example.com?method=browser&retain_images=true
  • POST mode:
    • POST https://markdown.new/
    • JSON body: {"url":"https://example.com","method":"auto","retain_images":false}

Prefer POST mode for automation and explicit parameters.

Limits And Safety

  • Treat 429 as rate limiting (documented limit: 500 requests/day/IP).
  • Convert only publicly accessible pages.
  • Respect robots.txt, terms of service, and copyright constraints.
  • Do not treat markdown.new output as guaranteed complete for every page; verify critical extractions.

References

  • references/markdown-new-api.md

相关文章

精彩推荐