PhoenixDiagrams.Router (phoenix_diagrams v0.2.2)

Copy Markdown View Source

Router helpers for mounting the PhoenixDiagrams diagram browser in a host Phoenix application.

defmodule MyAppWeb.Router do
  use MyAppWeb, :router
  import PhoenixDiagrams.Router

  scope "/" do
    pipe_through :browser
    live_phoenix_diagrams "/diagrams", diagrams_path: "priv/diagrams"
  end
end

PhoenixDiagrams renders on its own standalone page — it needs no changes to your app.js, assets/, or esbuild config. Its LiveView client JS, Mermaid and PlantUML rendering hooks are all served and bootstrapped automatically via a dedicated root layout and asset route mounted alongside the LiveView.

Summary

Functions

Mounts the PhoenixDiagrams diagram browser LiveView at path.

Functions

live_phoenix_diagrams(path, opts)

(macro)

Mounts the PhoenixDiagrams diagram browser LiveView at path.

Requires a :diagrams_path option pointing at the directory of .exs diagram definitions to scan — there is no default.

live_phoenix_diagrams "/diagrams", diagrams_path: "priv/diagrams"