# `PhoenixKit.Modules.Publishing.Renderer`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/publishing/renderer.ex#L1)

Renders publishing post markdown to HTML with caching support.

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

# `clear_all_cache`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/publishing/renderer.ex#L420)

Clears all publishing post caches.

Useful for testing or when doing bulk updates.

# `clear_group_cache`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/publishing/renderer.ex#L442)

```elixir
@spec clear_group_cache(String.t()) :: {:ok, non_neg_integer()} | {:error, any()}
```

Clears the render cache for a specific group.

Returns `{:ok, count}` with the number of entries cleared.

## Examples

    Renderer.clear_group_cache("my-group")
    # => {:ok, 15}

# `global_render_cache_enabled?`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/publishing/renderer.ex#L83)

```elixir
@spec global_render_cache_enabled?() :: boolean()
```

Returns whether the global render cache is enabled.
Checks new key first, falls back to legacy key.

# `group_render_cache_enabled?`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/publishing/renderer.ex#L96)

```elixir
@spec group_render_cache_enabled?(String.t()) :: boolean()
```

Returns whether render cache is enabled for a specific group.
Does not check the global setting.
Checks new key first, falls back to legacy key.

# `invalidate_cache`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/publishing/renderer.ex#L396)

Invalidates cache for a specific post.

Called when a post is updated in the admin editor.

## Examples

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

# `per_group_cache_key`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/publishing/renderer.ex#L111)

```elixir
@spec per_group_cache_key(String.t()) :: String.t()
```

Returns the settings key for per-group render cache.
Used by other modules that need to write to the setting.

# `render_cache_enabled?`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/publishing/renderer.ex#L71)

```elixir
@spec render_cache_enabled?(String.t()) :: boolean()
```

Returns whether render caching is enabled for a group.

Checks both the global setting and per-group setting.
Both must be enabled (or default to enabled) for caching to work.
Checks new keys first, falls back to legacy keys.

# `render_markdown`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/publishing/renderer.ex#L133)

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`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/publishing/renderer.ex#L46)

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).

Respects `publishing_render_cache_enabled` (global) and
`publishing_render_cache_enabled_{group_slug}` (per-group) settings.

## Examples

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
