You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Broken links for dependencies belonging to organizations #1975
I noticed that ex_doc generates wrong links for private packages belonging to organizations.
For example, if I have package linking to module Foo, which belongs to the package :foo, and :foo belongs to the organization my-org the automatic link will be hexdocs.pm/foo/Foo instead of my-org.hexdocs.pm/foo/Foo. Naturally, this link will be broken.
As you can see, it doesn't consider whether the package belongs to an organization or not.
I tried to fix it, but didn't find any API to find to which organization a package belongs to.
@wojtekmach suggested usings the :deps option for ex_doc to point the correct dependency documentation urls. While this works, it's a big burden to maintain, and I think this could be solved in a simple and more correct way at ex_doc.
@garazdawi this may be related to the conversation we had earlier this week. If we could store in the application the "documentation_url", then it could be used here too?
The configuration would have to live somewhere like that, so the app file seems like a reasonable place. I discuss it with the team next week and see what they say. If nothing else we can use an application parameter as the place to put it for this and errors.
If this can't be fixed short term, I'd love to have some decent workaround. I know I can use the :deps option to set the address of package docs.
But I don't know any way I can read my deps, and iterate on the ones that belong to organizations so that I can provide the correct address. I wouldn't like to hardcode the list of organization dependencies. The deps() function isn't enough as it doesn't include dependencies of dependencies.
You may be able to read the mix.lock and get all relevant information there. I guess we could also change ExDoc to look at the dependencies options and figure out private Hex repos. We could also allow :deps to be a function, so it is all programmatically.
I believe it would be great to have it alongside source_url and homepage_url so maybe projects like ElixirLS could also make use of it to provide link highlights to private docs.
Dependency URLs were built solely from the application name and loaded application version. The URL generation did not read the lock entry, which identifies the Hex organization and package name.
The docs task now reads the project lock and recognizes organization repositories in seven- and eight-element Hex lock entries. For those dependencies, it builds URLs using the organization host, locked package name, and loaded application version.
Activity
josevalim commentedon Dec 6, 2024
@garazdawi this may be related to the conversation we had earlier this week. If we could store in the application the "documentation_url", then it could be used here too?
garazdawi commentedon Dec 6, 2024
The configuration would have to live somewhere like that, so the app file seems like a reasonable place. I discuss it with the team next week and see what they say. If nothing else we can use an application parameter as the place to put it for this and errors.
v0idpwn commentedon Dec 7, 2024
If this can't be fixed short term, I'd love to have some decent workaround. I know I can use the
:depsoption to set the address of package docs.But I don't know any way I can read my deps, and iterate on the ones that belong to organizations so that I can provide the correct address. I wouldn't like to hardcode the list of organization dependencies. The
deps()function isn't enough as it doesn't include dependencies of dependencies.I appreciate suggestions on how to achieve that.
josevalim commentedon Dec 7, 2024
You may be able to read the mix.lock and get all relevant information there. I guess we could also change ExDoc to look at the dependencies options and figure out private Hex repos. We could also allow :deps to be a function, so it is all programmatically.
Wigny commentedon Dec 10, 2024
I believe it would be great to have it alongside
source_urlandhomepage_urlso maybe projects likeElixirLScould also make use of it to provide link highlights to private docs.mvanhorn commentedon Oct 11, 2026
Dependency URLs were built solely from the application name and loaded application version. The URL generation did not read the lock entry, which identifies the Hex organization and package name.
The docs task now reads the project lock and recognizes organization repositories in seven- and eight-element Hex lock entries. For those dependencies, it builds URLs using the organization host, locked package name, and loaded application version.
#2273