Skip to content

v0.1.4

Pre-release
Pre-release

Choose a tag to compare

@bitcryptic-gw bitcryptic-gw released this 09 Jul 05:33
· 23 commits to main since this release

Added

  • Vendored league/html-to-markdown (v5.1.1) with namespace scoping (MdfAnalytics\Vendor\League\HTMLToMarkdown) to eliminate class-redeclaration collisions if another plugin also vendors the same upstream library. No Composer required at runtime — the library is source-committed. Scoped via humbug/php-scoper, built by build-vendor.sh.
  • Pre-build markdown cache pipeline: all published posts are converted to CommonMark on save (via WP-Cron background job) and served to clients that send Accept: text/markdown. Markdown is never served for a URL until a pre-built .md file actually exists for it — no live-conversion fallback.
  • Cache directory at wp-content/uploads/mdf-cache/ with flat posts/ layout, per-post {post_id}.md + {post_id}.meta.json sidecars, and a manifest.json aggregate.
  • Settings toggle "Offer markdown to agents" — enabling it auto-queues a full backfill of all published posts. Disabling stops markdown serving immediately.
  • save_post hook computes content hash (SHA-256 of the_content() post-filter output) and skips rebuilds when unchanged. Atomic temp-file + rename writes keep the old .md servable throughout a rebuild.
  • template_redirect negotiation gating: checks file_exists() against the cached .md (single filesystem stat, no sidecar JSON read at request time), sets Vary: Accept and Content-Type: text/markdown only when cached content exists.
  • Backfill uses batched WP-Cron (mdf_backfill_batch) to avoid flooding the cron queue; admin notice shows progress during backfill.

Fixed

  • Manifest read-modify-write race: manifest.json updates are now wrapped with flock(LOCK_EX), preventing concurrent WP-Cron-driven writes (e.g. overlapping mdf_markdown_rebuild and mdf_backfill_batch events) from silently clobbering each other. The lock provides advisory exclusion around mdf_manifest_record_result() and the backfill-completion path; the existing atomic temp-file + rename is retained for reader safety.