It's better when it's simple

User Tools

Site Tools


nodisp Plugin

Compatible with DokuWiki

  • 2018-04-22 "Greebo" unknown
  • 2017-02-19 "Frusterick Manners" unknown
  • 2016-06-26 "Elenor Of Tsort" unknown
  • 2015-08-10 "Detritus" yes

plugin Hide text from view except from admin or manager

Last updated on

Similar to ifauth

Tagged with comment, hide


Download syntax.php from the source code below and install it in the folder: plugins/nodisp

Refer to Plugins on how to install plugins manually.


This plugin will conceal text from all viewers except users who are logged in and belong to either the admin or manager group. The text is still on the page, but not displayed. For true hiding, you would have to use the include plugin and set the appropritate ACLs.


<nodisp> your text here </nodisp>
your text here
and your text here
and here


Source Code

To download, click on syntax.php at the top of the code block below.

    // must be run within DokuWiki
    if(!defined('DOKU_INC')) die();
    if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
     * All DokuWiki plugins to extend the parser/rendering mechanism
     * need to inherit from this class
    class syntax_plugin_nodisp extends DokuWiki_Syntax_Plugin {
         * return some info
        function getInfo(){
            return array(
                'author' => 'Myron Turner',
                'email'  => 'turnermm02 AT shaw DOT ca',
                'date'   => '2016-01-16',
                'name'   => 'nodisp Plugin',
                'desc'   => 'hides display of enclosed text',
                'url'    => '',
        function getType(){ return 'formatting'; }
        function getPType(){ return 'stack'; }
        function getAllowedTypes() { return array('formatting', 'substition', 'disabled', 'protected', 'container', 'paragraphs' ); }   
        function getSort(){ return 168; }
        function connectTo($mode) { $this->Lexer->addEntryPattern('<nodisp.*?>(?=.*?</nodisp>)',$mode,'plugin_nodisp'); }
        function postConnect() { $this->Lexer->addExitPattern('</nodisp>','plugin_nodisp'); }
         * Handle the match
        function handle($match, $state, $pos, Doku_Handler $handler){
            switch ($state) {
              case DOKU_LEXER_ENTER : 
               return array($state, false);
              case DOKU_LEXER_UNMATCHED :  return array($state, $match);
              case DOKU_LEXER_EXIT :       return array($state, '');
            return array();
         * Create output
        function render($mode, Doku_Renderer $renderer, $data) {
            global $INFO;
            if($mode == 'xhtml'){
                $renderer->nocache(); // disable caching
                list($state, $match) = $data;
                switch ($state) {
                  case DOKU_LEXER_ENTER :  
                    if($INFO['isadmin'] || $INFO['ismanager'] ) break;   
                    $renderer->doc .= "<div style='display:none'>"; 
                  case DOKU_LEXER_UNMATCHED :  $renderer->doc .= $renderer->_xmlEntities($match); break;
                  case DOKU_LEXER_EXIT : 
                    if($INFO['isadmin'] || $INFO['ismanager'] ) break;   
                    $renderer->doc .= "</div>"; break;
                return true;
            return false;

Change Log

    • Fix method signature compatibility for PHP 7.0
    • Cache is automatically disabled now, no need for ~~NOCACHE~~ anymore
    • The plugin uses a <div>-Element now as it had the paragraph type stack anyway which meant that a new paragraph was opened inside the plugin and thus the plugin worked on block level and using a <span>-element produced invalid HTML.
    • Allows more syntax (paragraphs, lists, tables, …) inside the plugin

Known Bugs and Issues

Can you add this warning in the description of your plugin? Thanks. The page source is always visibile clicking the “show pagesource” button. — anto1945 2013/07/22 07:25

This is true for all the plugins which “hide” material. The only way to get true hiding is to use the include plugin. See the forum for this thread:
plugin/nodisp.txt · Last modified: 2016-01-16 22:12 by Michitux