add twister markdown support

This commit is contained in:
ghost 2022-01-03 19:20:28 +02:00
parent 07b770492f
commit 440fc1da3d
2 changed files with 13 additions and 0 deletions

View File

@ -27,6 +27,13 @@ textarea {
border: 0;
}
samp {
background: #777;
padding: 2px 4px;
color: #fff;
font-size: 11px;
}
/* backgrounds */
.bg-logo-1 {
background-image: url('/css/template/default/image/logo-1.png');

View File

@ -48,6 +48,12 @@ class Format {
public static function post(string $text) {
$text = preg_replace("|\*(.*?)\*|i", "<b>$1</b>", $text);
$text = preg_replace("|\~(.*?)\~|i", "<i>$1</i>", $text);
$text = preg_replace("|\_(.*?)\_|i", "<u>$1</u>", $text);
$text = preg_replace("|\-(.*?)\-|i", "<s>$1</s>", $text);
$text = preg_replace("|\`(.*?)\`|i", "<samp>$1</samp>", $text);
$text = preg_replace("|@([a-zA-Z0-9_]+)|i", "<a href=\"people/$1\">@$1</a>", $text);
$text = preg_replace("|((https?://)+([\d\w\.-]+\.[\w\.]{2,6})[^\s\]\[\<\>]*/?)|i", "<a href=\"$1\" target=\"_blank\">$3</a>", $text);
$text = nl2br($text);