Merge branch 'feature/bbcode' into 'develop'
BBCode support (backend) See merge request pleroma/pleroma!1097
This commit is contained in:
commit
002ea343f8
5 changed files with 41 additions and 1 deletions
|
|
@ -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.
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue