Skip to content

Move markdown_output filter out of the cached path - #13

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

retlehs merged 1 commit into
mainfrom
v1.7.1

Conversation

@retlehs

@retlehs retlehs commented Apr 18, 2026

Copy link
Copy Markdown
Member

Summary

  • markdown_output filter now runs per-request. Previously the filter was applied once and its result cached, so any request-dependent logic in user-installed filters (current user, current time, request context) was frozen into the first cached value. The filter now runs after the cache lookup on both hit and miss paths — expensive do_blocks / do_shortcode / league/html-to-markdown work stays memoized; customizations stay live.
  • Filter signature consistency fix. The function overwrote $content with do_blocks / do_shortcode / pre-flattened HTML before passing it to the filter as $original_html, contradicting the README's documented "original HTML content" description. Separate $rendered from $content so both hit and miss paths pass the raw function argument. Users writing filters can rely on $original_html meaning what the docs say it means.
  • post_content_to_markdown/conversion_cache_duration filter. Tunable TTL for the conversion cache, matching the existing feed_cache_duration pattern. Default stays at HOUR_IN_SECONDS.
  • README. Performance section notes that the conversion cache assumes deterministic rendering and points at the new TTL filter for dynamic-content cases. New filter documented under "Conversion filters".

Bumps to 1.7.1.

🤖 Generated with Claude Code

The markdown_output filter was called once, then its result was
cached. Any per-request customization (user-aware, time-aware, etc.)
got frozen into the cache. Apply the filter after the cache lookup
on both hit and miss paths so customizations run every request while
the expensive HTML → Markdown conversion stays memoized.

The function also overwrote $content with the rendered HTML before
passing it to the filter as $original_html, which contradicted the
README's documented "original HTML content" description. Separate
$rendered from $content so both cache paths pass the raw function
argument — consistent filter signature, matches the docs.

Add post_content_to_markdown/conversion_cache_duration filter so the
TTL is tunable, matching the existing feed_cache_duration convention.

Bump to 1.7.1.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@retlehs
retlehs merged commit c10471f into main Apr 18, 2026
1 check passed
@retlehs
retlehs deleted the v1.7.1 branch April 18, 2026 19:52
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