aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2019-04-26 10:17:57 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2019-04-26 22:35:02 +0000
commit501af917b5a9611a4b1fabb4944b3af96b676568 (patch)
tree767a42ad28ad3f9e88198a6fe80a230beac64735 /lib
parent2bd880be88839746040cd69e60380ab42a005ec4 (diff)
downloadpleroma-501af917b5a9611a4b1fabb4944b3af96b676568.tar.gz
add support for bbcode
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/common_api/utils.ex12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex
index 887f878c4..1dfe50b40 100644
--- a/lib/pleroma/web/common_api/utils.ex
+++ b/lib/pleroma/web/common_api/utils.ex
@@ -183,6 +183,18 @@ defmodule Pleroma.Web.CommonAPI.Utils do
end
@doc """
+ Formatting text as BBCode.
+ """
+ def format_input(text, "text/bbcode", options) do
+ text
+ |> String.replace(~r/\r/, "")
+ |> Formatter.html_escape("text/plain")
+ |> BBCode.to_html()
+ |> (fn {:ok, html} -> html end).()
+ |> Formatter.linkify(options)
+ end
+
+ @doc """
Formatting text to html.
"""
def format_input(text, "text/html", options) do