defmodule WebClientWeb.BlogView do use WebClientWeb, :view def image_preview(assigns) do # {"img", # [ # {"src", "https://e-matrix.at/assets/ematrix-large.png"}, # {"width", "196px"}, # {"style", "margin: 1rem; margin-top: 2rem;"} # ], []} img = case assigns.image do {"img", attrs, _} -> build_image_tag(attrs) e -> "#{inspect(e)}" end ~H""" <%= img %> """ end defp build_image_tag(attrs) do inspect(attrs, pretty: true) Enum.reduce_while(attrs, "", fn {"src", src}, _acc -> {:halt, raw(~s""" """)} _, acc -> {:cont, acc} end) end end