Summary: Tells you whether your markup is evaluated within (:markup:) code
Version: 2019-01-26
Prerequisites: PmWiki2 (developed and tested with 2.2.0-stable)
Status: stable
Maintainer: Tontyna
Categories: Markup, PHP55, PHP72, Obsolete

PmWiki version 2.2.110 and newer have the variable $MarkupMarkupLevel which has exactly the same value as this recipe ($SignalMarkupMarkup).

To use the core feature with old recipes relying on the old variable, try adding this to config.php:

$MarkupMarkupLevel = 0; 
$SignalMarkupMarkup = &$MarkupMarkupLevel;

Please report if it works. --Petko

Questions answered by this recipe

How can I tell whether my markup function is called within (:markup:) source code?


The script sets a global variable, $SignalMarkupMarkup, that tells you whether and how deep the 'markup chain' (MarkupToHTML / MarkupTable execution) is inside a (:markup:) code sequence.

Some cookbooks like SlimTableOfContents, TitleMarkup, SectionEdit need to know or should at least care about that.
They should / should not / should differently execute their code inside (:markup:) page source text.


Download signalwhenmarkup.phpΔ into your cookbook folder an activate it as usual by adding the following line to your local/config.php:


signalwhenmarkup_php55.patch.txtΔ Patch for PHP 5.5 compatibility, contributed by Jean-Pierre Chr├ętien.


Whenever you need to know whether your own markup is evaluated within (:markup:) code, check the value of global $SignalMarkupMarkup:

  $SignalMarkupMarkup == 0  - we are NOT in a (:markup:) sequence
  $SignalMarkupMarkup == 1...n we are in the n'th level


Works by redirecting the markups 'markup' and 'markupend'.

Release Notes

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

  • (2009-02-01) Initial version
  • (2016-10-23) Update for PHP 5.5 compatibility (by Siegfried Seibert)
    * (2019-01-26) Update for PHP 7.2 compatibility (by Siegfried Seibert)

See Also



See discussion at SignalWhenMarkup-Talk

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.