Are there each newline convert to each br tags?

hi

I’m looking for each newline convert to each br tags function.

https://hexdocs.pm/phoenix_html/Phoenix.HTML.Format.html#text_to_html/2

text_to_html function is two or more newlines convert to one p tag. but I want to output two or more br tags.
Are there solutions?
I apologize if this is in the documentation and I’m missing it.

(I’m sorry if my English is wrong)

1 Like
text
|> String.split("\n", trim: false) 
|> Enum.intersperse(Phoenix.HTML.Tag.tag(:br))
10 Likes

thank you so much!!

this is solution what I’m looking for.
thanks !!