Page 1 of 1

Markup: Serendipity - what exactly does it do?

Posted: Thu Jun 26, 2008 5:16 pm
by Don Chambers
Before I disable it completely, is there an explanation somewhere of what all this plugin does? There is definitely something it does that I do not want - which is marking text as bold with the asterisk.

In addition to wondering what all it "marks up", I'm also thinking it might be nice to provide a toggle for each of its features where, for instance, I could turn off the asterisk bolding (and not have it show up on the comment form) but leave everything else operational.

Posted: Thu Jun 26, 2008 6:10 pm
by judebert
It styles *bold*, /italic/, and _underlined_ text.

That's it. I believe those are mentioned somewhere around the editing box, but I can't remember.

Posted: Thu Jun 26, 2008 6:34 pm
by Don Chambers
Well, here's the actual code from the plugin:

Code: Select all

    function _s9y_markup($text) {
        $text = str_replace('\_', chr(1), $text);
        $text = preg_replace('/#([[:alnum:]]+?)#/','&\1;',$text);
        $text = preg_replace('/\b_([\S ]+?)_\b/','<u>\1</u>',$text);
        $text = str_replace(chr(1), '\_', $text);

        // bold
        $text = str_replace('\*',chr(1),$text);
        $text = str_replace('**',chr(2),$text);
        $text = preg_replace('/(\S)\*(\S)/','\1' . chr(1) . '\2',$text);
        $text = preg_replace('/\B\*([^*]+)\*\B/','<strong>\1</strong>',$text);
        $text = str_replace(chr(2),'**',$text);
        $text = str_replace(chr(1),'\*',$text);

        // $text = preg_replace('/\|([0-9a-fA-F]+?)\|([\S ]+?)\|/','<font color="\1">\2</font>',$text);
        $text = preg_replace('/\^([[:alnum:]]+?)\^/','<sup>\1</sup>',$text);
        $text = preg_replace('/\@([[:alnum:]]+?)\@/','<sub>\1</sub>',$text);
        $text = preg_replace('/([\\\])([*#_|^@%])/', '\2', $text);

        return $text;

Posted: Fri Jun 27, 2008 3:06 pm
by judebert
Okay, that code shows it also allows:
# for HTML escape codes (#amp# becomes &, for example)
^text^ for superscripted text
@text@ for subscripted text

And escaped codes, so "\*char *c" doesn't get bolded when you don't want it to.