defmodule MicrowavepropWeb.AlgoLive do
  @moduledoc false
  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"""
    <Layouts.app flash={@flash} current_scope={@current_scope}>
      <div class="markdown-content">
        {raw(@content)}
      </div>
    </Layouts.app>
    """
  end
end
