|Version 3 (modified by athomas, 10 years ago) (diff)|
Adds href anchors to section headings
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.
Note: This patch was applied to Trac trunk in changeset 1250.
If you have any issues, create a new ticket.
If you view the source of this page you will see that each of the headers has been given an anchor.