[Pmwiki-users] Making headings follow CSS

Patrick R. Michaud pmichaud
Tue Sep 21 12:41:40 CDT 2004

On Tue, Sep 21, 2004 at 01:22:34PM -0500, Jack Lutz wrote:
>    On  PmWiki2 I'm interested in making the ! !! !!! commands write <span
>    class=''>  rather  than  <h*>. Can someone help me with the PHP syntax
>    for it?

Do you just want !, !!, and !!!, or do you also want !!!!, !!!!!, and !!!!!!?

Assuming you only want the first three:

      "<span class='headerclass'>$1</span>");

This says to create a new markup rule called "^!span", do it before
any other block processing (where !-headings normally take place), 
and replace !, !!, or !!! lines with a <span>.

Note that <span> is inline HTML, you might really be wanting <div>...</div>
instead if you still want it to act like a heading.  If so, this
should probably be written as block markup (let me know if this is the

If you want each of the !, !!, and !!! to be different classes, you can
do something like:

      "'<span class=\'h'.strlen('$1').'\'>'.PSS('$2').'</span>'");

which does class='h1', class='h2', or class='h3' depending on the number
of leading !'s.  See http://www.pmwiki.org/pmwiki2/pmwiki.php/Test/SpanHeaders
to see how this renders.


More information about the pmwiki-users mailing list