| 开发者 | selvasudar |
|---|---|
| 更新时间 | 2026年3月9日 09:32 |
| 捐献地址: | 去捐款 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 6.9 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
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:
Accept: text/markdown headers.Content-Type: text/markdown, Vary: Accept, and X-Markdown-Word-Count.markdown-for-ai-agents folder to the /wp-content/plugins/ directory, or install it directly via the WordPress Plugins screen.curl -H "Accept: text/markdown" https://your-site.com/sample-page/
You should see plain Markdown text returned instead of HTML. For example:
curl -H "Accept: text/markdown" https://your-site.com/hello-world/
A successful response will begin with the post title as a Markdown heading (e.g. # Hello World) followed by the post content in Markdown format, with no HTML tags, navigation, or sidebar content.
Verifying it works — Option 2: Using a browser extension (no terminal required)
Accept, Value = text/markdown.Accept = text/markdown.No. Standard browser requests always receive the normal HTML version of your pages. The Markdown output is only served when a client explicitly includes Accept: text/markdown in its HTTP request header. No regular browser sends this header by default.
All singular content types are supported: standard Posts, Pages, and any registered Custom Post Types. Archive pages, category pages, and the homepage (if set to a blog feed) are not served as Markdown.
Use any of the three verification methods described in the Installation section above. The quickest check is: curl -H "Accept: text/markdown" https://your-site.com/sample-page/. A working response will return plain text starting with your post title as a Markdown # heading.
The Markdown output contains the full rendered post or page content — the title and body — converted to Markdown. Navigation menus, sidebars, footers, and <script> and <style> tags are automatically stripped out to provide a clean, token-efficient result for AI consumption.
The response includes:
Content-Type: text/markdown; charset=utf-8 — tells the client the content format.Vary: Accept — informs caches that the response varies based on the Accept header, preventing cached HTML from being served to Markdown clients.X-Markdown-Generator: Markdown for AI Agents — identifies the plugin.X-Markdown-Word-Count: [number] — the word count of the Markdown content.No. The Vary: Accept header is set on Markdown responses so that HTTP caches (including CDNs) correctly cache HTML and Markdown separately. Search engine crawlers do not send Accept: text/markdown headers, so they will always receive and index the normal HTML version of your pages.
The League HTMLToMarkdown library is bundled inside the plugin under includes/lib/HtmlToMarkdown/. No additional installation steps are required.
Yes. Because the plugin captures the fully rendered HTML output (after WordPress and any theme or plugin has finished building the page), it works regardless of whether your content is built with the Classic Editor, Gutenberg blocks, Elementor, or any other page builder.