diff options
author | Egor Kislitsyn <egor@kislitsyn.com> | 2019-05-07 16:51:11 +0700 |
---|---|---|
committer | Egor Kislitsyn <egor@kislitsyn.com> | 2019-05-07 16:51:11 +0700 |
commit | 1557b99beb3b406572ef2d3baaabed1c9baeca1c (patch) | |
tree | 34041b8526ecfa38fcb0b471718de0b3b71aa8c4 /lib/pleroma/web/common_api/utils.ex | |
parent | c157e27a000a12dc8f660c056744a6611beb01b1 (diff) | |
parent | 6518644db1d31f2b30b95fa0899b3751bc330d56 (diff) | |
download | pleroma-1557b99beb3b406572ef2d3baaabed1c9baeca1c.tar.gz |
Merge remote-tracking branch 'pleroma/develop' into feature/disable-account
Diffstat (limited to 'lib/pleroma/web/common_api/utils.ex')
-rw-r--r-- | lib/pleroma/web/common_api/utils.ex | 12 |
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 |