Daizu::Plugin::HeaderAnchor - add anchors to headings in all articles


This plugin filters articles and adds anchors (a elements with an id attribute but no href attribute) to all the headings (from h1 to h6). This allows people to link to a specific section of your web page.

The names used for the anchors are based on the textual content of the headings. All the names have a sec- prefix added.

Care is taken to ensure that anchor names aren't duplicated, although if the templates add any which start with the same prefix then it would be possible to get a duplicate value. Anchors are not added to headings which already contain an a element with either a name or id attribute.


To turn on this plugin, include the following in your Daizu CMS configuration file:

    <plugin class="Daizu::Plugin::HeaderAnchor" />


Daizu::Plugin::HeaderAnchor->register($cms, $whole_config, $plugin_config, $path)

Registers the plugin as a filter for all articles at or in $path.

$self->filter_article($cms, $file, $doc)

Does the actual filtering in-place on $doc and returns it. Currently $cms and $file are ignored.


This software is copyright 2006 Geoff Richards <>. For licensing information see this page: