algo.md was read at runtime via File.read! but isn't included in the release. Use @external_resource + compile-time module attribute to bake the HTML into the module.
26 lines
649 B
Elixir
26 lines
649 B
Elixir
defmodule MicrowavepropWeb.AlgoLive do
|
|
@moduledoc false
|
|
use MicrowavepropWeb, :live_view
|
|
|
|
@external_resource "algo.md"
|
|
@algo_html "algo.md" |> File.read!() |> Earmark.as_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"""
|
|
<div class="markdown-content">
|
|
<div class="mb-4">
|
|
<.link navigate="/map" class="btn btn-lg btn-ghost text-lg">
|
|
<.icon name="hero-arrow-left" class="size-4" /> Back to map
|
|
</.link>
|
|
</div>
|
|
{raw(@content)}
|
|
</div>
|
|
"""
|
|
end
|
|
end
|