]
# TODO: make it use something other than @link_regex
- def html_escape(text) do
+ def html_escape(text, "text/html") do
+ HTML.filter_tags(text)
+ end
+
+ def html_escape(text, "text/plain") do
Regex.split(@link_regex, text, include_captures: true)
|> Enum.map_every(2, fn chunk ->
{:safe, part} = Phoenix.HTML.html_escape(chunk)
subs =
subs ++
Enum.map(links, fn {uuid, url} ->
- {:safe, link} = Phoenix.HTML.Link.link(url, to: url)
-
- link =
- link
- |> IO.iodata_to_binary()
-
- {uuid, link}
+ {uuid, "<a href=\"#{url}\">#{url}</a>"}
end)
{subs, uuid_text}