Skip to content

Performance, discovery, and observability improvements - #12

Merged
retlehs merged 1 commit into
mainfrom
v1.7
Apr 18, 2026
Merged

retlehs merged 1 commit into
mainfrom
v1.7

Conversation

@retlehs

@retlehs retlehs commented Apr 18, 2026

Copy link
Copy Markdown
Member

Summary

  • Object cache conversion output. contentToMarkdown() now wraps the block-rendering + shortcode + HTML→Markdown pipeline with wp_cache_get / wp_cache_set keyed on a content hash. Sites with Redis/Memcached avoid re-running the conversion on repeat hits; no invalidation concern since a content change produces a new hash.
  • Advertise the .md alternate on HTML responses. Emit Link: <…>; rel="alternate"; type="text/markdown" as an HTTP header and <link rel="alternate" type="text/markdown" href="…"> inside <head>. RFC 8288-aware crawlers and HTML-parsing clients can now discover the Markdown representation without sending Accept: text/markdown.
  • X-Markdown-Source response header. Every Markdown response now carries X-Markdown-Source: accept | md-url | query so operators can see the negotiation mix in access logs without reading bodies.
  • post_content_to_markdown/cache_md_urls filter. .md URLs are distinct cache keys and in principle safely cacheable by WP page caches, but Super Cache / Batcache / etc. can transform response bodies assuming HTML (gzip, footer injection). Default stays false; sites whose page cache passes non-HTML bodies through untouched can opt in.
  • Tests. Added coverage for the <link> in <head>, the Link: HTTP header, and the three X-Markdown-Source values.

Bumps to 1.7.0.

🤖 Generated with Claude Code

- Object cache the HTML → Markdown conversion (wp_cache_get /
  wp_cache_set keyed on a content hash) so sites with a persistent
  object cache skip block rendering, shortcode expansion, and the
  league/html-to-markdown conversion on repeat hits.

- Advertise the .md alternate on HTML responses via an RFC 8288
  Link header and a <link rel="alternate" type="text/markdown"> tag
  in <head>, so RFC-8288-aware crawlers and HTML-parsing clients can
  discover the Markdown representation without sending
  Accept: text/markdown.

- Emit X-Markdown-Source: accept | md-url | query on every Markdown
  response so operators can see the negotiation mix in access logs.

- Add post_content_to_markdown/cache_md_urls filter (default false)
  so sites running a page cache that passes non-HTML bodies through
  untouched can opt .md URLs back into caching.

Bump to 1.7.0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@retlehs
retlehs merged commit 5cda0af into main Apr 18, 2026
1 check passed
@retlehs
retlehs deleted the v1.7 branch April 18, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant