From f8527c143033f51fecd929789ef7ad6589c8c2b4 Mon Sep 17 00:00:00 2001
From: Mischa POSLAWSKY
Date: Fri, 14 May 2021 17:26:40 +0200
Subject: [PATCH] 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).
---
upload.inc.php | 3 +++
1 file changed, 3 insertions(+)
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
--
2.30.0