common api: add support for formatting messages outside of twitter-style plain text
[akkoma] / lib / pleroma / formatter.ex
index cf2944c38fffa668ba6526dfd415af9ea10458ef..93cd12fa69132d920900fadef4ff329bc737a0ae 100644 (file)
@@ -188,7 +188,11 @@ defmodule Pleroma.Formatter do
   ]
 
   # TODO: make it use something other than @link_regex
-  def html_escape(text) do
+  def html_escape(text, "text/html") do
+    HtmlSanitizeEx.basic_html(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)