ReverseHeadings

Summary: Reverse !'s so that more !'s are larger headings
Version: 20170618
Prerequisites: pmwiki-2.2.58
Status: Stable
Maintainer: Petko (original author: Pm)
Categories: Markup, PHP55, PHP72
Votes:
Questions answered by this recipe

How can I change PmWiki's interpretation of the ! (heading) markup, so that more !'s result in larger headings?

Answer

Add the following to a local customization file:

  Markup('^!', 'block', '/^(!{1,6})(.*)$/', "ReverseHeadings");

  function ReverseHeadings($m) {
    return '<:block><h'.(7-strlen($m[1])).'>'.$m[2].'</h'.(7-strlen($m[1])).'>';
  }
Contributors
  • Petko, 20170618, updated for PHP 7.2
  • Petko, 20150627, updated for PHP 5.5
  • Pm, 20040319, updated for V2 20041012
Notes

This page has the ReverseHeadings recipe applied, so that more !'s result in larger headings.

!one bang
!!two bangs
!!!three bangs
one bang
two bangs

three bangs

See Also

User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.