defmodule LivebookWeb.Output.MarkdownComponent do use LivebookWeb, :live_component @impl true def mount(socket) do {:ok, socket |> assign(allowed_uri_schemes: Livebook.Config.allowed_uri_schemes()) |> stream(:chunks, [])} end @impl true def update(assigns, socket) do {text, assigns} = Map.pop(assigns, :text) socket = assign(socket, assigns) if text do chunk = %{id: Livebook.Utils.random_long_id(), text: text} {:ok, stream_insert(socket, :chunks, chunk)} else {:ok, socket} end end @impl true def render(assigns) do ~H"""