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.
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.