It's better when it's simple

User Tools

Site Tools


Label Plugin

Compatible with DokuWiki

Anteater, Rincewind, Angua

plugin Allows to mark parts of the wikipage with labels in order to be qualified for special use with the Embed Plugin

Last updated on

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with label, replace

Needed for reproduce


I've developed the plugin under the DokuWiki version of 2006-11-06 and seems to work with version 2007-06-26 as well.

Download / Installation

Download the plugin here (manually or via Plugin Manager):

Syntax and Use

The wiki-portion to mark has to be included in <label theLabel>wikicode</label>, whereas wikicode is arbitrary wikicode and theLabel is an identifier consisting of letters (a-z, A-Z), number (0-9) and underscore (_).


Here is a sample phrase:
<label example>
   The quick brown fox jumps over the lazy dog.

The example is labeled and can be processed by another plugin, e.g. the embed-plugin.

Labels and Lists

In order to be recognized as a list, a line in DokuWiki has to start with spaces before the leading *. Therefore, you are required to start a label after the *, like here:

  * <label element1>Element 1</label>
  * <label element2>Element 2</label>
  * <label element3>Element 3</label>


(sorry, will be properly indented when I have some time)

 * Plugin Label: Allows to mark parts of the wikipage with labels in order to 
 * be qualified for special use in other plugins
 * Sytnax: <label [a-zA-Z0-9_]+>...</label>
 * @license    GPL 2 (
 * @author     Pascal Bihler <>
// must be run within DokuWiki
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
class syntax_plugin_label extends DokuWiki_Syntax_Plugin {
		var $last_label = array();
		var $LABEL_PATTERN = "[a-zA-Z0-9_]+";
     * return some info
    function getInfo(){
        return array(
            'author' => 'Pascal Bihler',
            'email'  => '',
            'date'   => '2007-05-14',
            'name'   => 'Label Plugin',
            'desc'   => 'Allows to mark parts of the wikipage with labels',
            'url'    => '',
    function getType(){ return 'substition'; }
    function getPType(){ return 'normal'; }
    function getSort(){ return 100; }
    function connectTo($mode) { 
						 $this->Lexer->addSpecialPattern('<label\s+' . $this->LABEL_PATTERN . '\s*>',$mode,'plugin_label');
     * Handle the match
    function handle($match, $state, $pos, &$handler){
        switch ($state) {
          case DOKU_LEXER_SPECIAL : 
					    if (preg_match('/<label\s+(' . $this->LABEL_PATTERN . ')\s*>/',$match,$matches)) {
								 $labek = $matches[1];		
					    	 return array("start", $label);
						  } else if ($match == "</label>") {		
							   $label = array_pop($this->last_label);	 
					    	 return array("end", $label);
        return array();
     * Create output
    function render($mode, &$renderer, $data) { //doesn't do much, since label is something internal
        return true;
//Setup VIM: ex: et ts=4 enc=utf-8 :
plugin/label.txt · Last modified: 2015-09-13 19:22 by Aleksandr

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki