For what it's worth. I work at Atlassian and we don't use Confluence for documenting code.
Unfortunately the docs-in-repo + PRs-for-updates approach has way more friction for drive-by-corrections/commentary/Q&A from people not on the team, so it's not a holy grail either.
[0]: https://developer.atlassian.com/cloud/
[1]: https://gohugo.io
[2]: https://github.com/Redocly/redoc