Skip to content

Conversation

@artberger
Copy link
Contributor

@artberger artberger commented Sep 22, 2025

followup to #583, for https://github.com/solo-io/doctopus/issues/124, more context in Slack

Tested by doing this in the gloo repo:

  1. Pull in my changes in this PR by running go get github.com/solo-io/solo-kit@adb-anchors2
  2. make generate-all -B
  3. example of changes in this commit: solo-io/gloo@1c5105e
    BOT NOTES:
    resolves https://github.com/solo-io/doctopus/issues/124

Signed-off-by: Art Berger <[email protected]>
@artberger artberger self-assigned this Sep 22, 2025
@artberger artberger added the bug Something isn't working label Sep 22, 2025
Signed-off-by: Art Berger <[email protected]>
@solo-changelog-bot
Copy link

Issues linked to changelog:
https://github.com/solo-io/doctopus/issues/124

return printPointer
// For Hugo, we need to generate the same numbered anchors as toAnchorLink
// Track anchor names to handle duplicates
anchorCounts := make(map[string]int)

Choose a reason for hiding this comment

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

At first, this looks a bit strange but is the idea that anchorCounts is declare here because toHeading() is called only once and anchorCounts get "auto"captured into the returned function and that's the function that will get called multiple times? That's a clever hack without local static like in C++.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah the toHeading is called once during the template setup, but this returned function is called for each heading instance. We needed separate anchorCounts funcs under both toHeading and toAnchorLink because they were counting different things (headings vs anchors), so to keep them in sync so the headings match the anchor counts. Before without this, it was only counting the anchors and replacing it for non-heading links 😅

@soloio-bulldozer soloio-bulldozer bot merged commit b5ba58e into main Sep 23, 2025
4 checks passed
@soloio-bulldozer soloio-bulldozer bot deleted the adb-anchors2 branch September 23, 2025 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working keep pr updated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants