Skip to content

docs: disambiguate generic headings to prevent anchor collisions#4907

Open
mihir-dixit2k27 wants to merge 9 commits intoprometheus:mainfrom
mihir-dixit2k27:docs/fix-anchor-conflicts
Open

docs: disambiguate generic headings to prevent anchor collisions#4907
mihir-dixit2k27 wants to merge 9 commits intoprometheus:mainfrom
mihir-dixit2k27:docs/fix-anchor-conflicts

Conversation

@mihir-dixit2k27
Copy link
Contributor

Description

Renames generic headings (like http_config, link_config) to include their context (e.g., (Shared), (PagerDuty)) to prevent URL anchor collisions.

Issue

Fixes #4725

Changes

  • docs/configuration.md: Disambiguated shared and integration-specific headings.

@SoloJacobs
Copy link
Contributor

It looks a bit off to me tbh, but works as intended I suppose:
image
Sadly, I haven't figured out a way to render the real documentation yet.

@mihir-dixit2k27
Copy link
Contributor Author

Thanks for the reviews and approvals, @ultrotter and @SoloJacobs!

I agree it slightly changes the visual flow. The main goal here was to resolve the anchor collision issue in a minimal and consistent way so deep-linking works reliably across the page.

If there’s a preferred alternative formatting that achieves the same result, I’m happy to adjust. Otherwise, I’ll defer to your judgment.

Copy link
Contributor

@siavashs siavashs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a simple approach to fix it.
The docs generator should handle these properly in the first place so maybe we can fix that later on.

Potentially we can fix this inprometheus/docs:

// Replace sequences of non-word characters with single dashes. Remove
// extra dashes at the beginning or end.
//
// Example: <http_config> => "http_config"
function generateAnchor(text: string) {
  return text.replace(/\W+/g, "-").replace(/^-+|-+$/g, "");
}

One option could be adding a unique random suffix to each anchor, then there will be no collisions.

@siavashs
Copy link
Contributor

siavashs commented Feb 24, 2026

@mihir-dixit2k27 check my comment above about an alternative fix for this.

@mihir-dixit2k27
Copy link
Contributor Author

Thanks for the approval and for the suggestion, @siavashs!

I agree that ideally this should be handled at the docs generator level, and improving anchor generation in prometheus/docs would be a cleaner long-term solution.

For this PR, I aimed to keep the change minimal and scoped to resolving the immediate anchor collision issue.

I’m happy to open a follow-up issue to explore improving the anchor generation logic separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Potential Anchor link conflicts in docs

5 participants