Skip to content

Resolve intersphinx to own project as current build #9169

Closed
@nstarman

Description

@nstarman

Is your feature request related to a problem? Please describe.

Motivated from astropy/astropy#11690

Take packages A and B, with package A as the core package and package B as an affiliate package.

When B subclasses a class from package A, docstrings can be inherited from the A class. If the docstring contains a reference, e.g.:doc:`/path/to` , then this link will incorrectly point to the documentation in the B package, not in the A package.

One option is to make the links intersphinx links, e.g. :doc:`A:/path/to` . While this is useful for the B package, now the link is broken for the A package, or at best refers to an old version of the docs: whatever is specified in the intersphinx mapping.

Describe the solution you'd like

Allow intersphinx references to the package being built to be "stripped" of the intersphinx portion and be resolved as local links. In the example above, :doc:`A:/path/to` -> :doc:`/path/to` when in package A. Now both packages A and B can use the same links. B gets an intersphinx link, A gets a link to the current build.

Describe alternatives you've considered

In astropy/astropy#11690 we implemented a bit of a hack by setting a function with higher priority than intersphinx to change the link types. While this works, a built-in solution would be better.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions