THE GITHTML FIELD GUIDE
Prevent duplicate Markdown headings from breaking shared links
Give repeated sections distinct, descriptive headings when readers need stable links to them. Render the page and copy its actual generated section link rather than guessing a suffix. Automatic anchor naming belongs to the publishing system, so duplicate-heading behavior can differ between GitHub and a separate Markdown-to-HTML documentation build.
Find the repeated heading's real purpose
Long README files often repeat headings such as Installation, Example, and Notes under different platforms. Those names can be understandable in the visual hierarchy yet ambiguous when someone shares a section link outside the page. Rename the headings around their tasks: Install the command-line package and Install the editor extension. This improves navigation even before considering anchor generation. Preserve a familiar existing heading when changing it would disrupt important external references; the repair may require an explicit compatibility anchor if the publishing system supports one. Do not assume a title-only edit has no effect on incoming links.
Inspect generated links instead of predicting them
Open the rendered page and use its heading-link control or inspect the actual target identifier. Duplicate headings may receive generated suffixes, but those suffixes can shift when sections are reordered or new duplicates are inserted. Record the current links to the sections you intend to change. Build a scratch fixture with three repeated headings and compare it with the revised, specific headings. Run the fixture through each supported renderer. The aim is to learn the pipeline's behavior, not to establish a universal numbering rule that another tool may reject. Keep this check local; it does not require publication.
# Package guide
## Install the command-line package
## Install the editor extension
## Configure the editor extensionTreat heading edits as navigation changes
After renaming, update the manual table of contents, sibling-page links, and any known support references that point to the old fragments. Follow the links in the built output, including links arriving from another document. Check whether the user lands near the intended content with a useful surrounding heading. Avoid adding hidden duplicate text solely to preserve every accidental historical anchor. Where compatibility is necessary, use the generator's documented mechanism and state how long it will remain. A section title should describe the answer it contains, and its public link should remain deliberate rather than an incidental result of section order. Add a short changelog note for widely shared section renames. Support teams may have saved links outside the repository, and a deliberate announcement gives them a chance to update those references.
- Inventory repeated headings and identify the task each one actually describes.
- Copy real generated fragments from the current preview before renaming anything.
- Test inbound links after the edit and record intentional compatibility anchors in the authoring notes.
Sources and further reading
AI-assisted writing with source-linked guidance and illustrative examples. Read our editorial approach or report a correction.