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

Simpler linking from doc pages to API reference page #146

Closed
pchalasani opened this issue Jul 17, 2023 · 2 comments · Fixed by #187
Closed

Simpler linking from doc pages to API reference page #146

pchalasani opened this issue Jul 17, 2023 · 2 comments · Fixed by #187
Assignees
Labels
enhancement New feature or request

Comments

@pchalasani
Copy link
Contributor

We need the ability to link from a doc page in say docs/intro.md to an API doc page or sub-page (e.g. the "anchor" link to a class definition in the API page). For example in the Pydantic docs here: https://docs.pydantic.dev/latest/usage/models/

Currently we are having to provide the full path to the API doc page/anchor, e.g.

/reference/language_models/base/#langroid.language_models.base.LLMMessage

which is not fun to do. In the Pydantic docs they manage to achieve the linkage using just the portion after the #.
We need to figure out what settings in mkdocs.yml and/or other places need to be adjusted to achieve this.
Note that we are using auto-generated API doc pages via the gen-files plugin, and docs/auto_docstring.py script.
Pydantic's source code has some other plugins like this https://github.com/pydantic/pydantic/blob/main/docs/plugins/griffe_doclinks.py
Maybe we can use these as well.

@pchalasani pchalasani added the enhancement New feature or request label Jul 17, 2023
@AshishHoodaIITD AshishHoodaIITD self-assigned this Jul 17, 2023
@pawamoy
Copy link

pawamoy commented Jul 25, 2023

Have you seen the docs for cross-references? https://mkdocstrings.github.io/usage/#cross-references

You don't need custom code, you can cross-ref to any API object using this syntax: [SomeObject][pkg.module.SomeObject].

@pchalasani
Copy link
Contributor Author

Thanks for pointing this out (I recognize you're the author of the excellent mkdocstrings package!). Yes indeed we did look at the docs, but the linking did not work. It may have something to do with the fact that we are auto-generating the docs pages using the gen-files in mkdocs.yml and auto_docstring.py script.

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

Successfully merging a pull request may close this issue.

3 participants