defmodule MicrowavepropWeb.AlgoLive do @moduledoc "Renders `algo.md` as HTML at `/algo` — documents the scoring algorithm." use MicrowavepropWeb, :live_view @external_resource "algo.md" @algo_html "algo.md" |> File.read!() |> Microwaveprop.Markdown.to_html!() @impl true def mount(_params, _session, socket) do {:ok, assign(socket, page_title: "Algorithm", content: @algo_html)} end @impl true def render(assigns) do ~H"""
<%!-- Safe: @content is pre-rendered from checked-in algo.md at compile time via @external_resource (not user input). If the rendering pipeline ever accepts dynamic input, switch to Phoenix.HTML.raw/1 from a sanitized source or a Phoenix.Component function component. --%> {raw(@content)}
""" end end