diff options
author | raeno <just.raeno@gmail.com> | 2018-12-18 14:59:32 +0100 |
---|---|---|
committer | raeno <just.raeno@gmail.com> | 2018-12-18 14:59:32 +0100 |
commit | a3003364598b42849e384a216948dad810481f51 (patch) | |
tree | 2ed2b04efab457220a60fb7630906b1b26f24df3 /lib/pleroma/web/common_api/utils.ex | |
parent | 30812f84518f1b2fcc70a416d1a6b9f81264f3a5 (diff) | |
parent | b6ae412fcd7c67d64dd1467e8e35d17140e992df (diff) | |
download | pleroma-a3003364598b42849e384a216948dad810481f51.tar.gz |
Merge branch 'develop' into oembed_provider
Diffstat (limited to 'lib/pleroma/web/common_api/utils.ex')
-rw-r--r-- | lib/pleroma/web/common_api/utils.ex | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index ce0926b99..142283684 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -112,6 +112,9 @@ defmodule Pleroma.Web.CommonAPI.Utils do Enum.join([text | attachment_text], "<br>") end + @doc """ + Formatting text to plain text. + """ def format_input(text, mentions, tags, "text/plain") do text |> Formatter.html_escape("text/plain") @@ -123,6 +126,9 @@ defmodule Pleroma.Web.CommonAPI.Utils do |> Formatter.finalize() end + @doc """ + Formatting text to html. + """ def format_input(text, mentions, _tags, "text/html") do text |> Formatter.html_escape("text/html") @@ -132,8 +138,12 @@ defmodule Pleroma.Web.CommonAPI.Utils do |> Formatter.finalize() end + @doc """ + Formatting text to markdown. + """ def format_input(text, mentions, tags, "text/markdown") do text + |> Formatter.mentions_escape(mentions) |> Earmark.as_html!() |> Formatter.html_escape("text/html") |> String.replace(~r/\r?\n/, "") |