forked from savetheinternet/Tinyboard
-
Notifications
You must be signed in to change notification settings - Fork 198
markup
Fredrick Brennan edited this page Apr 18, 2019
·
2 revisions
Since v0.9.6, Tinyboard’s markup syntax has become customizable. $config['markup']
is an array of markup rules. Each markup rule is an array containing a regular expression for matching the text, and a replacement which can either be a string (using $*
references), or a callback.
The input has already been HTML-escaped.
$config['markup'][] = array("/'''(.+?)'''/", "<strong>\$1</strong>");
$config['markup'][] = array("/''(.+?)''/", "<em>\$1</em>");
$config['markup'][] = array("/\*\*(.+?)\*\*/", "<span class=\"spoiler\">\$1</span>");
$config['markup'][] = array("/^\s*==(.+?)==\s*$/m", "<span class=\"heading\">\$1</span>");
(Of course this isn’t exactly how it will look.)
Input | Output |
---|---|
''text'' |
<em>text</em> |
'''text''' |
<strong>text</strong> |
**text** |
<span style="background:#000000;color:#FFFFFF;padding:2px;">text</span> |
==text== |
<span style="font-size:2em;font-weight:bold;">text</span> |
$config['markup'][] = array("/<3/", "♥");
Input | Output |
---|---|
<3 |
♥ |
Callbacks can be used for more advanced markup.
$config['markup'][] = array(
'/MD5<(.+)>/',
function($matches) {
return md5($matches[1]);
}
);
Input | Output |
---|---|
MD5<test> |
098f6bcd4621d373cade4e832627b4f6 |