-
I need help finding the configuration option to customize how functions are displayed in the documentation. I'm trying to publish documentation for my custom package using mkdocstrings-python. Still, the function sections are displayed as "Methods" by default. Is it possible to change this to "Functions"? Similarly, I'd like to change the "meth" pill/badge to "func." I notice that on the mkdocstrings-python official site (for example, https://mkdocstrings.github.io/reference/debug/#mkdocstrings.debug), functions are displayed under "Functions" sections with "func" pills, but I can't find which configuration option controls this behavior. Please let me know if you need any additional information. I appreciate any help you can provide. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @yasuhito. "Methods" is used for functions inside classes. Functions and methods are basically the same thing, we just call those "methods" when they're, well, methods. If you'd prefer using a "func" label for both, see https://mkdocstrings.github.io/python/usage/customization/#symbol-types. For auto-generated summary tables, you'll have to override the relevant template ( Let me know if that helps! |
Beta Was this translation helpful? Give feedback.
-
@pawamoy Thank you for your detailed and helpful response! The explanation about methods vs functions makes perfect sense, and the links you provided for customization were exactly what I needed. I really appreciate you taking the time to explain this clearly. This solved my problem completely. |
Beta Was this translation helpful? Give feedback.
Hi @yasuhito. "Methods" is used for functions inside classes. Functions and methods are basically the same thing, we just call those "methods" when they're, well, methods. If you'd prefer using a "func" label for both, see https://mkdocstrings.github.io/python/usage/customization/#symbol-types. For auto-generated summary tables, you'll have to override the relevant template (
docstring/functions.html.jinja
) to replace occurrences of "Methods" with "Functions". For manually written summaries, use a "Functions" docstring section instead of a "Methods" one (see https://mkdocstrings.github.io/griffe/reference/docstrings/#google-section-functions).Let me know if that helps!