Raw not working as I would expect

phoenix
phoenix_html
html

#1
<%=
  @post.tags      
  |> Enum.map(fn tag -> link(tag.name, to: Routes.post_tag_path(@conn, :show_post, tag)) |> raw end) 
  |> IO.inspect 
  |> Enum.join(", ") 
  |> raw 
%>

Note: there is a raw method being piped in right after link

Gives me.

protocol String.Chars not implemented for {:safe, [60, "a", [[32, "href", 61, 34, "/posts/tag/1", 34]], 62, "bam", 60, 47, "a", 62]}. 
This protocol is implemented for: Atom, BitString, Date, DateTime, Decimal, Exexif.Data.Gps, Exexif.Data.Thumbnail, Float, Integer, List, NaiveDateTime, Postgrex.Copy, Postgrex.Query, Time, URI, Version, Version.Requirement

my inspect show that even though I pipe into raw in my map I still end up with a safe tuple

[
  safe: [
    60,
    "a",
    [[32, "href", 61, 34, "/posts/tag/1", 34]],
    62,
    "bam",
    60,
    47,
    "a",
    62
  ]
]

thoughts?


#2

Looks like I need to look into Enum.intersperse to use instead of join and the short answer was to replace raw with safe_to_string