From: Mischa POSLAWSKY
Date: Fri, 14 May 2021 15:26:40 +0000 (+0200)
Subject: widget/reply: formatting syntax for
X-Git-Tag: v5.3~5
X-Git-Url: http://git.shiar.nl/minimedit.git/commitdiff_plain/f8527c143033f51fecd929789ef7ad6589c8c2b4
widget/reply: formatting syntax for
Recognise common notation (as in Markdown), extended for optional link
names after pipe (as in Slack) or whitespace (assuming escaped in urls).
---
diff --git a/upload.inc.php b/upload.inc.php
index d7d572d..86af604 100644
--- a/upload.inc.php
+++ b/upload.inc.php
@@ -52,6 +52,9 @@ function messagehtml($input)
return $input; # allow html input as is if privileged
}
$markup = [
+ '{<((?:\w+:|/).+?)>}' => '<$1>', # unescape link entities
+ '{<(?:https?://)?([^>\s|]+)>}' => '<$1 $1>', # unnamed link
+ '{<([^>\s|]+)[\s|]([^>]+)>}' => '$2', # hyperlink
"/\r\n?/" => "\n", # unix newlines
"/ +\n/" => "
", # trailing spaces for hard line break
"/\n/" => "
\n", # newlines start paragraphs