-
-
Notifications
You must be signed in to change notification settings - Fork 52
Module prefix in navigation bar #277
-
Hello! I would like to add the module name in front of function names in the navigation bar, similar to what the numpy API reference does (see e.g. the navigation of numpy.linalg.eig). So instead of having only eig in the navigation bar, they have numpy.linalg.eig.
My particular documentation based on mkdocs-material + mkdocstrings-python is here, see for instance our function dq.plot.wigner. I have already hacked around to add the dq.plot prefix in front of wigner in the article title, but I'm not able to add it to the navigation bar (nor to the search bar actually). Any way I could achieve this? Thanks.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 6 replies
-
We always use short names in the navigation bar, as there's not a lot of width available, but I'm open to a feature request asking for a configuration option 🙂
Beta Was this translation helpful? Give feedback.
All reactions
-
You'd add a new show_nav_full_path option in the config.pymodule (next to the other similar boolean options). Then you'd use this option in the templates where relevant (inheading` filters typically). Finally you'd document this new option in the headings configuration page, probably (options are ordered alphabetically) 🙂
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
About the search bar, I'm not sure what you mean, could you elaborate?
Beta Was this translation helpful? Give feedback.
All reactions
-
I would like to full path to appear in the search bar too.
Taking the example of my library, I have two separate functions with the same name but in different modules: dq.wigner, and dq.plot.wigner. When searching for "wigner", both appear under the same name and there's no way to differentiate.
See the screenshot below, with the last two pages:
Screenshot 2025年05月14日 at 15 22 01Beta Was this translation helpful? Give feedback.
All reactions
-
Note that even numpy has such duplicate namings in different modules, for instance:
Or:
- numpy.char.chararray.real
- numpy.generic.real
- numpy.ma.masked_array.real
- numpy.matrix.real
- numpy.memmap.real
- numpy.ndarray.real
- numpy.real
- ...
which would all appear under the name "real" when searching with mkdocs.
Beta Was this translation helpful? Give feedback.
All reactions
-
We don't have control over the search bar (which comes from the MkDocs theme in use), but you could display the full object paths in the headings, and the search bar would pick them up. You're looking at the show_object_full_path: true option 🙂
Beta Was this translation helpful? Give feedback.