An other, it’s not exactly what you want is to write a component like this:
def markdown(assigns) do
text = if assigns.text == nil, do: "", else: assigns.text
markdown_html =
String.trim(text)
|> Earmark.as_html!(code_class_prefix: "lang- language-")
|> Phoenix.HTML.raw()
assigns = assign(assigns, :markdown, markdown_html)
~H"""
<%= @markdown %>
"""
end
And then use it like: <.markdown text="your markdown text here" />






















