widget/reply: formatting syntax for ~strike~ and `code`
authorMischa POSLAWSKY <perl@shiar.org>
Sat, 15 May 2021 21:51:02 +0000 (23:51 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 17 May 2021 18:53:38 +0000 (20:53 +0200)
Remaining inline options in common chat systems.

upload.inc.php

index 0ee432bc538a8f82f0fe5d1ea135b4524d948b7d..4f5c5fe564e85b3c133bf53e82630ac249e90915 100644 (file)
@@ -60,6 +60,8 @@ function messagehtml($input)
                "/\n/"    => "</p>\n<p>", # newlines start paragraphs
                '/_(?<!\w_)(.+?)_(?!\w)/'      => '<em>$1</em>',         # italic
                '/\*(?<!\w\*)(.+?)\*(?!\w)/'   => '<strong>$1</strong>', # bold
+               '/~(?<!\w~)(.+?)~(?!\w)/'      => '<s>$1</s>',           # stricken
+               '/`(?<!\w`)(.+?)`(?!\w)/'      => '<code>$1</code>',     # monospace
        ];
        $html = preg_replace(array_keys($markup), array_values($markup), htmlspecialchars($input));
        return "<p>$html</p>";