Opened 5 years ago

Closed 5 years ago

#4406 closed defect (bug) (fixed)

Avoid duplicate anchors when generating table of contents in the Handbook

Reported by: garrett-eclipse's profile garrett-eclipse Owned by: coffee2code's profile coffee2code
Milestone: Priority: normal
Component: Handbooks Keywords:



As suggested by @sergey in Slack I'm opening this ticket to address the duplicate anchors that can occur when the same heading is used multiple times in a document.

For instance originally the Working with Patches document had several 'Applying a Patch' references which all anchored to '#applying-a-patch' so they'd all lead to the first item.

I've addressed this by manually making all the headings unique for this page;

It was indicated the code for this is located here;

All the best,

Change History (3)

This ticket was mentioned in Slack in #core-docs by garrett-eclipse. View the logs.

5 years ago

#2 @coffee2code
5 years ago

  • Owner set to coffee2code
  • Status changed from new to accepted

#3 @coffee2code
5 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 8899:

Handbook plugin: Prevent duplicate anchors when generating table of contents links from heading tags.

Previously, if text for a heading was used more than once in the page, the same anchor would be created for each heading, making the second (and subsequent) duplicates untargetable and the toc links would all point to the first instance.

Fixes #4406.

Note: See TracTickets for help on using tickets.