[WordPress] 外掛分享: Markdown for AI Agents

首頁外掛目錄 › Markdown for AI Agents
10+
安裝啟用
尚無評分
7 天前
最後更新
問題解決
WordPress 6.9+ PHP 7.4+ v1.0.0 上架:2026-03-08

內容簡介

Markdown for AI Agents 是一款輕量級的 WordPress 外掛,能夠為網站內容提供 HTTP 內容協商功能。當客戶端(如 AI 代理或自訂腳本)請求帶有 Accept: text/markdown 標頭的頁面時,外掛會攔截請求並返回乾淨、結構化的 Markdown 格式內容,適合 AI 爬蟲及非瀏覽器客戶端使用。

【主要功能】
• 自動檢測 Accept: text/markdown 標頭
• 使用 League HTMLToMarkdown 庫轉換 HTML 內容為 Markdown
• 去除佈景主題佈局、導航、標頭、頁尾及側邊欄
• 添加有用的 HTTP 回應標頭
• 遵循 WordPress 可見性規則與過濾器
• 無需配置,開箱即用於文章、頁面及自訂文章類型

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.0.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Markdown for AI Agents」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Markdown for AI Agents is a lightweight WordPress plugin that enables HTTP content negotiation for your site’s content. When a client (like an AI agent or a custom script) requests a page with the Accept: text/markdown header, the plugin intercepts the request and returns a clean, structured Markdown representation of the post or page content.
This is ideal for AI crawlers, RAG (Retrieval-Augmented Generation) systems, and non-browser clients that prefer machine-friendly text over complex HTML.
Important note: This plugin is primarily a developer/integration tool. Human visitors browsing your site will never see any difference — the Markdown output is only served when explicitly requested via the Accept: text/markdown HTTP header. Normal browser requests always receive the standard HTML page.
Key Features:

Automatically detects Accept: text/markdown headers.
Converts HTML content to clean Markdown using the League HTMLToMarkdown library.
Strips away theme layout, navigation, headers, footers, and sidebars — serving only the main content.
Adds useful HTTP response headers: Content-Type: text/markdown, Vary: Accept, and X-Markdown-Word-Count.
Respects WordPress visibility rules and filters.
No configuration required — works out of the box for posts, pages, and custom post types.

How It Works
This plugin uses a standard web technique called HTTP content negotiation. The same URL on your site can serve different representations of the same content depending on what the client asks for:

A regular browser sends Accept: text/html → receives your normal HTML page.
An AI agent sends Accept: text/markdown → receives a clean Markdown version of the same page.

No extra URLs, no duplicate content, no configuration needed. The plugin hooks into WordPress’s template_redirect action, detects the Accept header, captures the rendered HTML, converts it to Markdown, and returns it with appropriate headers.
Why Markdown for AI Agents?
When building RAG (Retrieval-Augmented Generation) applications or AI pipelines that ingest web content, HTML is extremely noisy. A typical WordPress page contains thousands of tokens worth of HTML tags, inline styles, navigation menus, scripts, and layout markup — none of which carries meaning for an AI model.
Serving clean Markdown instead can reduce token consumption by up to 60%, which means:

Lower API costs — fewer tokens ingested when loading pages into vector stores or LLM pipelines.
Faster processing — less text for the model to parse, filter, and discard.
Better retrieval accuracy — higher signal-to-noise ratio improves the quality of RAG results.
Simpler pipelines — no need for custom HTML stripping logic on the client side; the plugin handles it server-side.

Any AI agent, crawler, or ingestion script that sends Accept: text/markdown in its request header will automatically receive the clean Markdown version — no extra URLs, no separate endpoints, no changes to your content workflow.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon