It's better when it's simple

User Tools

Site Tools


Revision Link Plugin

Compatible with DokuWiki


plugin Extend internal link syntax to allow linking to a previous revision a of page.

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 links, revisions


Just append '@<revision #>' to the page name of an internal link, e.g.

[[page@1234567890|Page (old version)]]


Just copy the code below into the file lib/plugins/revlink/syntax.php

For more help, refer to Plugins on how to install plugins manually.

Wish list

  • Append to tooltip the revision a link is linking to.
  • Be more permissive with the revision number, perhaps linking to the last revision at or before the given revision number.
  • Allow other formats for referring to a revision, such as date and time


  • Possibly would not work with other XHTML renderer plugins, as revlink assumes the existence of a particular set of arguments on the renderer's internallink method.


 * Revision Link plugin
 * Syntax: internal links with '@<revision #>' appended to the
 *         page name will make links to that revision of the page.
 *         e.g. [[page@1234567890|Page (old version)]]
 * @license    GPL 2 (
 * @author     Braden Pellett <>
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
 * revlink plugin
class syntax_plugin_revlink extends DokuWiki_Syntax_Plugin {
    * Get an associative array with plugin info.
    function getInfo(){
        return array(
            'author' => 'Braden Pellett',
            'email'  => '',
            'date'   => '2009-01-25',
            'name'   => 'Revision Link',
            'desc'   => 'Extend internal link syntax to allow linking to a previous revision a of page.',
            'url'    => '',
    * We are a substitution type.
    function getType(){
        return 'substition';
    * Hijack internallink.
    function connectTo($mode) {
    * Sort position only matters if another plugin uses mapHandler to remap
    * 'internallink'.  Two such plugins cannot coexist, as far as I know.
    function getSort(){
        return 999;
    * Do $hander's internallink work, and if we find that it was actually
    * an internal link and one that contained a revision reference, then
    * pull that out and pass it on to our renderer.
    function handle($match, $state, $pos, &$handler){
        $handler->internallink($match, $state, $pos);
        if($call[0] == 'internallink'){
            preg_match('/^(.*?)(?:@(\d+))?(#.*?)?$/', $call[1][0], $matches);
                $data=array($matches[1].$matches[3], $matches[2], $call[1][1]);
        return $data;
    * Render internal link as XHTML using normal procedure, and then in the
    * href part of the resulting XHTML we add in the needed ?rev=xxxx.
    function render($mode, &$renderer, $data) {
        if($mode == 'xhtml'){
            $xhtml=$renderer->internallink($data[0], $data[2], NULL, true);
            $renderer->doc .= preg_replace('/(href=".*?)((#.*?)?")/', '$1&rev='.$data[1].'$2', $xhtml);
            return true;
        return false;


It seems that revlink is not compatible with siteexport 2016-08-30. Deactivate the siteexport plugin to work with revlink.

plugin/revlink.txt · Last modified: 2016-10-07 15:47 by