PhoenixKit.Blogging.Renderer (phoenix_kit v1.6.4)

View Source

Renders blog post markdown to HTML with caching support.

Uses PhoenixKit.Cache for performance optimization of markdown rendering. Cache keys include content hashes for automatic invalidation.

Summary

Functions

Clears all blog post caches.

Invalidates cache for a specific post.

Renders markdown or .phk content directly without caching.

Renders a post's markdown content to HTML.

Functions

clear_all_cache()

Clears all blog post caches.

Useful for testing or when doing bulk updates.

invalidate_cache(blog_slug, identifier, language)

Invalidates cache for a specific post.

Called when a post is updated in the admin editor.

Examples

Renderer.invalidate_cache("docs", "getting-started", "en")

render_markdown(content)

Renders markdown or .phk content directly without caching.

Automatically detects .phk XML format and routes to PageBuilder. Falls back to Earmark markdown rendering for non-XML content.

Examples

html = Renderer.render_markdown(content)

render_post(post)

Renders a post's markdown content to HTML.

Caches the result for published posts using content-hash-based keys. Lazy-loads cache (only caches after first render).

Examples

{:ok, html} = Renderer.render_post(post)