Search documentation of phoenix_kit

# PhoenixKit.Blogging.Renderer (phoenix_kit v1.6.19)

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

clear_all_cache()

Clears all blog post caches.

invalidate_cache(blog_slug, identifier, language)

Invalidates cache for a specific post.

render_markdown(content)

Renders markdown or .phk content directly without caching.

render_post(post)

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)