You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Access a feed of your posts in Markdown format at `/feed/markdown/`:
24
+
25
+
**Example:**
26
+
27
+
```bash
28
+
curl https://example.com/feed/markdown/
29
+
```
30
+
31
+
The feed includes:
32
+
- Feed metadata (site name, description, last updated, feed URL)
33
+
- Post title, author, publication date (ISO 8601), and permalink
34
+
- Post categories and tags
35
+
- Post content converted to Markdown
36
+
- Optional excerpt support
37
+
- Optional comment support
38
+
39
+
**Example Output:**
40
+
41
+
```markdown
42
+
# My WordPress Site - Markdown Feed
43
+
44
+
**Description:** Just another WordPress site
45
+
**Last Updated:** 2025-10-03T19:45:00+00:00
46
+
**Feed URL:**https://example.com/feed/markdown/
47
+
48
+
---
49
+
50
+
# Hello World!
51
+
52
+
**Author:** John Doe
53
+
**Published:** 2025-10-03T12:00:00+00:00
54
+
**URL:**https://example.com/hello-world/
55
+
**Categories:** News, Updates
56
+
**Tags:** announcement, wordpress
57
+
58
+
Welcome to WordPress. This is your first post. Edit or delete it, then start writing!
59
+
60
+
---
61
+
```
62
+
63
+
**Feed URL structure:**
64
+
65
+
The Markdown feed is accessible at `https://yoursite.com/feed/markdown/`. Note that WordPress requires pretty permalinks to be enabled (Settings → Permalinks must be set to anything other than "Plain").
66
+
67
+
**Autodiscovery:**
68
+
69
+
The plugin automatically adds a `<atom:link>` element to your site's RSS feed, allowing feed readers and LLMs to discover the Markdown version:
2. Place in `wp-content/plugins/post-content-to-markdown/`
31
87
3. Activate via wp-admin or WP-CLI
32
88
89
+
**Note:** After activation, you may need to flush rewrite rules by visiting Settings → Permalinks and clicking "Save Changes" if the `/feed/markdown/` endpoint doesn't work immediately.
90
+
33
91
## Filters
34
92
35
93
The plugin provides several filters for customization:
36
94
37
-
### `post_content_to_markdown/post_types`
95
+
### Single post filters
96
+
97
+
#### `post_content_to_markdown/post_types`
38
98
39
-
Filter the post types that can be served as markdown.
99
+
Filter the post types that can be served as Markdown for single posts.
40
100
41
101
```php
42
102
add_filter('post_content_to_markdown/post_types', function ($post_types) {
@@ -47,7 +107,71 @@ add_filter('post_content_to_markdown/post_types', function ($post_types) {
47
107
48
108
**Default:**`['post']`
49
109
50
-
### `post_content_to_markdown/converter_options`
110
+
### Feed filters
111
+
112
+
#### `post_content_to_markdown/feed_post_types`
113
+
114
+
Filter the post types included in the Markdown feed.
115
+
116
+
```php
117
+
add_filter('post_content_to_markdown/feed_post_types', function ($post_types) {
Filter the cache duration for the Markdown feed in seconds.
163
+
164
+
```php
165
+
add_filter('post_content_to_markdown/feed_cache_duration', function ($duration) {
166
+
return 2 * HOUR_IN_SECONDS; // Cache for 2 hours
167
+
});
168
+
```
169
+
170
+
**Default:**`HOUR_IN_SECONDS` (1 hour)
171
+
172
+
### Conversion filters
173
+
174
+
#### `post_content_to_markdown/converter_options`
51
175
52
176
Filter the HTML to Markdown converter options.
53
177
@@ -64,25 +188,33 @@ add_filter('post_content_to_markdown/converter_options', function ($options) {
64
188
65
189
**Available options:**
66
190
-`header_style`: `'atx'` (default) or `'setext'`
67
-
-`strip_tags`: Remove HTML tags without markdown equivalents (default: `true`)
191
+
-`strip_tags`: Remove HTML tags without Markdown equivalents (default: `true`)
68
192
-`remove_nodes`: Space-separated list of DOM nodes to remove (default: `'script style'`)
69
193
-`hard_break`: Convert `<br>` to newlines (default: `true`)
70
194
71
-
### `post_content_to_markdown/markdown_output`
195
+
####`post_content_to_markdown/markdown_output`
72
196
73
-
Filter the final markdown output after conversion.
197
+
Filter the final Markdown output after conversion.
74
198
75
199
```php
76
200
add_filter('post_content_to_markdown/markdown_output', function ($markdown, $original_html) {
77
-
// Add a footer to all markdown output
201
+
// Add a footer to all Markdown output
78
202
return $markdown . "\n\n---\nConverted from HTML to Markdown";
79
203
}, 10, 2);
80
204
```
81
205
82
206
**Parameters:**
83
-
-`$markdown`: The converted markdown text
207
+
-`$markdown`: The converted Markdown text
84
208
-`$original_html`: The original HTML content
85
209
210
+
## Performance
211
+
212
+
The Markdown feed is cached for 1 hour by default to optimize performance. The cache is automatically cleared when:
213
+
- A post is published or updated
214
+
- A post is deleted
215
+
216
+
You can customize the cache duration using the `post_content_to_markdown/feed_cache_duration` filter.
217
+
86
218
## Resources
87
219
88
220
*[Serving Markdown Based on Accept Headers and User Agent Detection](https://benword.com/serving-markdown-based-on-accept-headers-and-user-agent-detection)
0 commit comments