Skip to content

Add Markdown Feeds experiment#194

Open
Jameswlepage wants to merge 10 commits intoWordPress:developfrom
Jameswlepage:feature/markdown-feeds
Open

Add Markdown Feeds experiment#194
Jameswlepage wants to merge 10 commits intoWordPress:developfrom
Jameswlepage:feature/markdown-feeds

Conversation

@Jameswlepage
Copy link
Contributor

@Jameswlepage Jameswlepage commented Jan 19, 2026

Summary

Adds Markdown representations of WordPress content for feeds and singular views:

  • Feed at /?feed=markdown with autodiscovery links
  • Singular Markdown via .md permalinks and Accept: text/markdown
  • HTML to Markdown conversion via WP_HTML_Processor with fallback to WP_HTML_Tag_Processor
  • Section-level filters to reorder/extend output (e.g., inject custom fields)
  • Integration tests for feed and converter behavior

Implementation Details

  • Markdown_Feeds registers the feed, .md parsing, and Accept header negotiation
  • HTML_To_Markdown_Converter uses the WordPress HTML API to produce Markdown
  • Settings toggles for feed, .md permalinks, and Accept header negotiation
  • New filters: ai_experiments_markdown_feed_post_sections and ai_experiments_markdown_singular_post_sections

Test plan

  • Enable experiment under Settings -> AI Experiments
  • Visit /?feed=markdown and confirm text/markdown output
  • Visit /hello-world.md and confirm text/markdown output
  • Request a post with Accept: text/markdown and confirm Markdown output
  • Optional: use the new section filters to inject custom fields into output
  • npm run test:php -- --filter Markdown_Feeds
Open WordPress Playground Preview

- Add feed autodiscovery links in HTML head
- Add Link rel=canonical header for .md URLs
- Add post visibility checks (private, password-protected)
- Add HTTP caching (Last-Modified, ETag, 304 responses)
- Add table, figure/figcaption, and cite tag support
- Refactor .md URL handling to use request filter
- Fix leading whitespace in output
- Add comprehensive test coverage
@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

❌ Patch coverage is 40.51447% with 370 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.62%. Comparing base (1351969) to head (50ae614).
⚠️ Report is 5 commits behind head on develop.

Files with missing lines Patch % Lines
...udes/Experiments/Markdown_Feeds/Markdown_Feeds.php 22.91% 185 Missing ⚠️
...eriments/Markdown_Feeds/Markdown_Feed_Renderer.php 0.00% 94 Missing ⚠️
...ents/Markdown_Feeds/Markdown_Singular_Renderer.php 0.00% 71 Missing ⚠️
...ents/Markdown_Feeds/HTML_To_Markdown_Converter.php 90.74% 20 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #194      +/-   ##
=============================================
- Coverage      50.80%   49.62%   -1.19%     
- Complexity       375      610     +235     
=============================================
  Files             27       31       +4     
  Lines           1978     2827     +849     
=============================================
+ Hits            1005     1403     +398     
- Misses           973     1424     +451     
Flag Coverage Δ
unit 49.62% <40.51%> (-1.19%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Jameswlepage
Copy link
Contributor Author

Marking this as an open PR so we can get this merged. @m and others are quite interested in this feature

@Jameswlepage Jameswlepage marked this pull request as ready for review February 3, 2026 19:24
@github-actions
Copy link

github-actions bot commented Feb 3, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Jameswlepage <isotropic@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>
Co-authored-by: m <matt@git.wordpress.org>
Co-authored-by: jeffpaul <jeffpaul@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@m
Copy link

m commented Feb 3, 2026

We have some pretty URL prior art here with /feed/[format] that we should support in addition to the query string.

This would be the first time we introduce dots into WP's canonical URL structures... how should we think about that? Remember that we have other things that exist in the hierarchy of the permalink itself, so when you make the permalink a filename you lose that ability to have sub-directories or files.

@Jameswlepage Jameswlepage requested a review from dkotter February 3, 2026 20:28
@jeffpaul jeffpaul added this to the Future Release milestone Feb 4, 2026
@jeffpaul jeffpaul moved this to In discussion / Needs decision in WordPress AI Planning & Roadmap Feb 4, 2026
@jeffpaul
Copy link
Member

jeffpaul commented Feb 5, 2026

@Jameswlepage before we move for review, I think Matt raised some questions that we should settle out before proceeding. Did you have immediate reactions to those questions (especially in case you've had conversations on this topic that would inform approach here)? If not, then I can look to sort through those with Darin to get this PR back on track towards review.

@Jameswlepage
Copy link
Contributor Author

Ah shoot, I didn't actually push up my changes. Yeah, I agree with Matt on the file extension. I'm seeing it as a common convention, so my inclination is to keep it but default to a format query parameter instead of the extension by default. I am not on my desktop right now, so I'll see if I can get that up soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In discussion / Needs decision

Development

Successfully merging this pull request may close these issues.

4 participants