-
-
Notifications
You must be signed in to change notification settings - Fork 51
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
To Reproduce
Here is a simple module with a public and a protected function.
def test():
"""test."""
pass
def _test():
"""_test."""
pass
Other options can be set to default values as follows.
plugins:
- mkdocstrings:
default_handler: python
handlers:
python:
options:
group_by_category: false
filters: []Then, the _test() method is not appeared in the generated document.
Full traceback
Full traceback
DEBUG - mkdocstrings_handlers: python\templates\material\function.html.jinja: Rendering mod.test.test
DEBUG - mkdocstrings_handlers: python\templates\material\signature.html.jinja: Rendering signature
DEBUG - mkdocstrings_handlers: python\templates\material\docstring.html.jinja: Rendering docstring
# the following lines won't appear if `group_by_category` is set to `false`
DEBUG - mkdocstrings_handlers: python\templates\material\function.html.jinja: Rendering mod.test._test
DEBUG - mkdocstrings_handlers: python\templates\material\signature.html.jinja: Rendering signature
DEBUG - mkdocstrings_handlers: python\templates\material\docstring.html.jinja: Rendering docstringExpected behavior
Environment information
- System: Windows 10
- Python: cpython 3.10.11
- Environment variables:
- Installed packages:
mkdocstrings-pythonv2.0.0
Additional context
I have tried to pinpoint the issue in children.html.jinja, and find the following lines:
{% if config.group_by_category %}
... irrelevant codes here ...
{% else %}
{% for child in obj.all_members
|filter_objects(
filters=config.filters,
members_list=members_list,
inherited_members=config.inherited_members,
keep_no_docstrings=config.show_if_no_docstring,
)
|order_members(config.members_order, members_list)
%}
{% if not (obj.is_class and child.name == "__init__" and config.merge_init_into_class) %}
{% if config.filters == "public" or members_list is not none or child.is_public %}
... rendering codes here ...
{% endif %}
{% endif %}
{% endfor %}
{% endif %}I validate the filtering part, and the results are correct, so the problem may be inside the rendering part. Comparing with the similar codes in the if-branch, there is a significant difference in the code:
{% if config.filters == "public" or members_list is not none or (not child.is_imported or child.is_public) %}After adding these lines, the problem will be resolved on my device.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working