Dot MD
WordPress plugin to generate a markdown version of a post when /md/ or .md is appended to the post URL.
by Paid Memberships Pro · github.com/ideadude/dot-md · 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/ideadude/dot-md/archive/refs/heads/master.zipConvert WordPress posts to Markdown with a simple URL pattern
A simple WordPress plugin that lets you view or download any post/page as Markdown by adding /md/ or .md to the URL.
Quick Start
# Clone the repo
git clone https://github.com/ideadude/dot-md.git
# Move to WordPress plugins directory
mv dot-md /path/to/wordpress/wp-content/plugins/
# Activate in WordPress admin
Usage
View in Browser
Add /md/ to any post URL:
https://example.com/my-post/ → Original
https://example.com/my-post/md/ → Markdown (displays in browser)
Download File
Add .md to any post URL (requires web server configuration):
https://example.com/my-post.md → Downloads markdown file
Installation & Configuration
1. Install Plugin
- Upload to
/wp-content/plugins/dot-md/ - Activate via WordPress admin
/md/endpoint works immediately
2. Configure Web Server (Optional)
To enable .md downloads, add a rewrite rule:
Apache (.htaccess)
Add before standard WordPress rules:
# Custom rule for .md downloads
RewriteRule ^(.+)\.md$ /$1/md/?download=1 [QSA,L]
Nginx
Add to server block:
rewrite ^/(.+)\.md$ /$1/md/?download=1 last;
Features
- 🚀 Zero Config - Works immediately after activation
- 📝 Smart Conversion - Handles headers, lists, links, images, code, tables, blockquotes
- ⚡ Cached - Generated markdown cached for 1 week, auto-refreshed on updates
- 🎯 Two Modes - View in browser or download file
- 🔧 Developer Friendly - Filterable output, clean code
- 📊 Metadata - Includes title, date, author, permalink in every file
Use Cases
- AI Integration: Feed content to Claude, ChatGPT, or other LLMs
- Content Migration: Export to static site generators (Hugo, Jekyll, etc.)
- Documentation: Quick export for developer docs
- Archival: Backup content in portable format
- Cross-platform: Share content in universal format
Developer API
Filters
dotmd_markdown_output - Modify markdown before output
add_filter( 'dotmd_markdown_output', function( $markdown, $post ) {
// Add custom footer
$markdown .= "\n\n---\nGenerated by My Company";
return $markdown;
}, 10, 2 );
Cache Management
Markdown is cached using WordPress transients:
- Key pattern:
dotmd_{post_id}_v{version} - Duration: 1 week
- Auto-cleared on: Post update, post deletion
How It Works
- Detect - WordPress rewrite endpoint catches
/md/in URL - Convert - HTML → Markdown using league/html-to-markdown (namespaced to
DotMD\HtmlToMarkdown) - Cache - Store result in transient for 1 week
- Serve - Output with appropriate headers (inline or attachment)
Custom Converters
This plugin extends the base league/html-to-markdown library with custom converters for cleaner, more AI-friendly markdown output:
SemanticConverter
Strips semantic HTML5 tags while preserving content:
<article>,<header>,<section>,<footer>,<main>,<aside>,<nav><figure>,<figcaption>,<cite>,<span>
InlineFormatConverter
Handles additional inline formatting:
<s>,<del>,<strike>→~~strikethrough~~<u>and<mark>→ stripped (no markdown equivalent)
InputConverter
Converts HTML form inputs to markdown equivalents:
<input type="checkbox" checked>→[x](task lists)<input type="checkbox">→[ ](task lists)
DetailsConverter
Handles collapsible HTML5 details/summary:
<summary>→**bold summary text**<details>→ clean content blocks
IframeConverter
Converts embedded iframes to clean links:
- `