Upgrade Earmark to v1.4.10

This commit is contained in:
Alex Gleason 2020-10-13 00:27:51 -05:00 committed by Mark Felder
commit e9e17e5df3
8 changed files with 95 additions and 261 deletions

View file

@ -138,6 +138,14 @@ defmodule Pleroma.Formatter do
|> Enum.join("")
end
def minify({text, mentions, hashtags}, type) do
{minify(text, type), mentions, hashtags}
end
def minify(text, "text/html") do
String.replace(text, "\n", "")
end
def truncate(text, max_length \\ 200, omission \\ "...") do
# Remove trailing whitespace
text = Regex.replace(~r/([^ \t\r\n])([ \t]+$)/u, text, "\\g{1}")