MW Markdown Rendering
wordpress plugin for markdown formatted posts
by Matt Warren · github.com/mfwarren/mw-markdown-endpoint · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/mfwarren/mw-markdown-endpoint/archive/refs/heads/main.zipServe any post or page as clean Markdown. Adds alternate link tags and an /llms.txt index for AI crawlers.
Description
MW Markdown Endpoint adds three lightweight features to your WordPress site:
1. Markdown output for any post or page
Append ?format=md to any published post or page URL to get a clean Markdown version with YAML frontmatter (title, date, author, canonical URL). Useful for content syndication, backup, and making your content accessible to AI tools.
2. Alternate link tags
Automatically adds a <link rel="alternate" type="text/markdown"> tag to the <head> of every published post and page, so crawlers and tools can discover the Markdown version.
3. /llms.txt index
Serves an /llms.txt file listing all published posts and pages with their Markdown URLs. This follows the emerging llms.txt convention for helping AI crawlers discover and index your content.
Key features:
- Pure PHP — no external dependencies or libraries
- Converts Gutenberg block content to clean Markdown
- Handles headings, lists, code blocks, tables, images, links, blockquotes, and more
- YAML frontmatter with post metadata
- Skips drafts, private posts, and password-protected content
- Sets
X-Robots-Tag: noindexon Markdown responses to avoid duplicate content issues - Caches /llms.txt for 1 hour
Installation
- Upload the
mw-markdown-endpointfolder to/wp-content/plugins/ - Activate the plugin through the 'Plugins' menu in WordPress
- That's it — no configuration needed
Verify it works:
- Visit any published post URL with
?format=mdappended - View source on any post and look for the
<link rel="alternate" type="text/markdown">tag - Visit
yoursite.com/llms.txtto see the content index
Frequently Asked Questions
Does this work with the block editor (Gutenberg)?
Yes. The plugin processes Gutenberg block content through WordPress core functions before converting the rendered HTML to Markdown.
What HTML elements are converted?
Paragraphs, headings (h1-h6), ordered and unordered lists, code blocks (fenced and inline), bold, italic, links, images, blockquotes, horizontal rules, and tables.
Does this affect my site's SEO?
No. Markdown responses include an X-Robots-Tag: noindex header, so search engines will not index the Markdown versions of your content.
Can I use this with password-protected or draft posts?
No. The plugin only serves Markdown for published, non-password-protected posts and pages. All other content returns a 404.
Does this require any configuration?
No. The plugin works immediately after activation with zero configuration.
What is llms.txt?
llms.txt is an emerging convention (similar to robots.txt or sitemap.xml) that helps AI systems discover and understand your site's content. It provides a structured index of your published content with links to machine-readable versions.
Changelog
1.0.0
- Initial release
- Markdown output via ?format=md query parameter
- Alternate link tags in post/page head
- /llms.txt content index endpoint
- Pure-PHP HTML-to-Markdown converter supporting all standard Gutenberg blocks
Upgrade Notice
1.0.0
Initial release.