Merge branch 'feature/bbcode' into 'develop'

BBCode support (backend)

See merge request pleroma/pleroma!1097
This commit is contained in:
kaniini 2019-04-27 07:44:24 +00:00
commit 002ea343f8
5 changed files with 41 additions and 1 deletions

View file

@ -182,6 +182,18 @@ defmodule Pleroma.Web.CommonAPI.Utils do
end).()
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.
"""