Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using *relative imports* to cross-reference inside the project #489

Open
leandro-lucarella-frequenz opened this issue Nov 1, 2022 · 1 comment
Labels
feature New feature or request

Comments

@leandro-lucarella-frequenz

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

When writing cross-references inside the project, links become a bit too verbose. For example, if we have:

# module some.deep.nested.module_a
class A:
    """A class.

    We reference [B][some.deep.nested.module_b.B].
    """

class AA:
    """AA class.

    We reference [A][some.deep.nested.module_a.A].
    """
# module some.deep.nested.module_b
class B:
    """B class.

    We reference [A][some.deep.nested.module_a.A].
    """

Here references can get really difficult to write. Another alternative would be to write [some.deep.nested.module_a.A][], which saves a few chars (depending on the name of the leaf symbol), but then the produced documentation becomes too verbose if we are already at the context of a some.deep.nested package.

Describe the solution you'd like

Allow writing local cross-references using relative imports and local symbols. In the example above:

# module some.deep.nested.module_a
class A:
    """A class.

    We reference [B][.module_b.B].
    """

class AA:
    """AA class.

    We reference [A][].
    """
# module some.deep.nested.module_b
class B:
    """B class.

    We reference [.module_a.A][].
    """

Describe alternatives you've considered

Just using the fully qualified symbol as stated above.

Additional context

None really, just that I know it would be hard to implement :)

@leandro-lucarella-frequenz leandro-lucarella-frequenz added the feature New feature or request label Nov 1, 2022
@analog-cbarber
Copy link

See mkdocstrings/python#27 and the corresponding PR mkdocstrings/python#28

That just solves the problem for python but I expect most users are using the python handler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants