It's better when it's simple

User Tools

Site Tools


Bookmark Plugin

Compatible with DokuWiki

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

plugin Insert a link anchor into the page

Last updated on

Similar to anchor

Tagged with anchor, bookmark, links


With this plugin you can insert a bookmark to your page. The format is


This will insert code

<a name='bookmark_name'></a>

To link to the bookmark from the same page (i.e. to use the bookmark as an anchor link within the page), use this syntax:


Where anchor_text is the text-link your visitors will see.


Install with Plugin Manager from here


Create a new folder lib/plugin/bookmark/ and place the following file in it: syntax.php.


 * Plugin bookmark: Creates a bookmark to your document.
 * @license    GPL 2 (
 * @author     Otto Vainio <>
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
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_bookmark extends DokuWiki_Syntax_Plugin {
     * return some info
    function getInfo(){
        return array(
            'author' => 'Otto Vainio',
            'email'  => '',
            'date'   => '2005-08-01',
            'name'   => 'Bookmark plugin',
            'desc'   => 'a bookmark <a name=\'name\'></a>',
            'url'    => '',
     * What kind of syntax are we?
    function getType(){
        return 'substition';
    function getSort(){ return 357; }
    function connectTo($mode) {
     * Handle the match
    function handle($match, $state, $pos, &$handler){
        $match = substr($match,10,-1); //strip <BOOKMARK: from start and > from end
        return array(strtolower($match));
     * Create output
    function render($mode, &$renderer, $data) {
        if($mode == 'xhtml'){
            $renderer->doc .= '<a name="' . $data[0] . '" id="' . $data[0]. '"></a>';
            return true;
        return false;
base   bookmark
author Otto Vainio
date   2005-08-01
name   Bookmark Plugin
desc   Insert a link anchor into the page


I Installed this plugin, but this script didn't work. I tried to use the syntax but it didn't work. Is there any manual or samples about this plugin?

Hi. Remember to use capital letters for BOOKMARK. So the format is: <BOOKMARK:name> With the < and > marks. <bookmark:name> will not work… sorry — Otto Vainio 2006-09-04 12:08

While it works nicely with Firefox, it does not work for me with MSIE 6.0.2800.1106CO SP1, unless is hack the syntax.php to add an id attribute alongside to the name attribute of the anchor tag:

<a name='name' id='name'></a>

Yes I know that MSIE sucks, but DokuWiki uses the same trick for the anchor tags automatically generated for headings… — Gábor Ziegler 2007/06/15 10:01

Hi ! I just love this plugin. But I failed to address one of this bookmarks from within the wiki?


Does not work … Markus A. Engelkamp

Is it possible to use this plugin to point to a particular section of the page?

This plugin doesn't appear to work in the current version of DokuWiki.

It works well for me with the DokuWiki Release 2009-12-25c “Lemming” on Wiki Eolienne

I tested it with release 2013-05-10a “Weatherwax” and it worked, even without file.

2013/07/03 22:42


I tested it with release 2014-05-05a “Ponder Stibbons” and it worked. 2014/07/31 11:00am

It would be great if other characters, apart from word characters (\w) are allowed in the anchor name. I.e. I have modified syntax.php, line 43 to “$this→Lexer→addSpecialPattern('<BOOKMARK:[\w\-]+>',$mode,'plugin_bookmark');” since I needed '-' in the anchor name.

I tested it with the most recent release 2015-08-10 “Detritus”, works great!

EDIT: 2017-04-09
Tested with current version - Release 2017-02-19b “Frusterick Manners”, works.

needed following code to get stuff working. The anchor is hidden - just an empty a tag as it seems from source-code


plugin/bookmark.txt · Last modified: 2020-02-23 19:44 by Aleksandr