wiki:AnchorPatch

Adds href anchors to section headings

Notice: This plugin is deprecated. The patch was applied to Trac trunk in [trac 1250].

Description

The AnchorPatch automatically adds href anchors to section headings.

Anchor names are generated from the headings using the following logic:

  • The heading name with all non-alphanumeric characters stripped.
  • If the heading is not unique a numeric offset is added to the second instance, starting at 1.

For example, the heading Bugs/Feature Requests in the TocMacro page is given the anchor TocMacro#BugsFeatureRequests. This method of generating anchor names was chosen as it allows human readable use of the anchors with minimal effort. If a second heading with the same name existed, the anchor would be TocMacro#BugsFeatureRequests1.

The patch also adds support for anchors to TracLinks, as evidenced above.

Bugs/Feature Requests

Existing bugs and feature requests for AnchorPatch are here.

If you have any issues, create a new ticket.

Download

download:anchorpatch

Source

You can check out the source for AnchorPatch from Subversion at http://trac-hacks.org/svn/anchorpatch.

Example

If you view the source of this page you will see that each of the headers has been given an anchor.

Author/Contributors

Author: athomas
Maintainer: none
Contributors:

Last modified 11 days ago Last modified on Aug 17, 2014 7:03:17 PM