Maybe add a helper function that would replace all newline characters like \n with <br> with the help of Phoenix.HTML.Format.text_to_html/2.
defmodule YourAppWeb.SomeHelperView do
use YourAppWeb, :view
@doc """
Shows text in paragraphs by converting new line characters `\n` to `<br>` tags.
"""
def paragraphed_text(text)
@spec paragraphed_text(nil) :: []
def paragraphed_text(nil), do: [] # in case your database returns `nil`
@spec paragraphed_text(String.t()) :: Phoenix.HTML.safe()
def paragraphed_text(text) do
text_to_html(text)
end
end