feature: Support hiding details in file __init__.py
feature
## Description
This is the structure of my document directory:
```tree
📁my_package/
├─📄__init__.py
├─📄my_module1.py
└─📄my_module2.py
```
And my *mkdocs.yml*:
```yml
plugins:
- search:
- meta:
- tags:
- autorefs:
resolve_closest: true
- gen-files:
scripts:
- scripts/gen_doc_pages.py
- literate-nav:
nav_file: summary.md
- mkdocstrings:
handlers:
python:
inventories:
- https://docs.python.org/3/objects.inv
options:
show_bases: true
show_source: false
heading_level: 2
parameter_headings: true
show_symbol_type_heading: true
show_symbol_type_toc: true
members_order: source
summary: true
docstring_section_style: spacy
separate_signature: true
show_signature_annotations: true
annotations_path: source
line_length: 80
overloads_only: true
merge_init_into_class: true
signature_crossrefs: true
filters: ["!^_"]
show_root_full_path: false
extensions:
- griffe_inherited_docstrings:
- griffe_pydantic:
schema: true
- griffe_typingdoc:
- griffe_warnings_deprecated:
- griffe_modernized_annotations:
```
If my *my_package/\_\_init\_\_.py* is like this:
```py
"""Some module docstring."""
from .my_module1 import *
```
And if my Markdown file *my_package.md* is like this:
```md
::: my_package
```
Then, on page *my_package*, all the detailed content of the classes and functions in module `my_module1` will be displayed, which obviously overlaps somewhat with the content of page *my_module1*.
For example:
<img width="1552" height="1874" alt="Image" src="https://github.com/user-attachments/assets/7cc661ca-52db-45fa-a666-c4f45cb98806" />
## Expected
Page *my_package* only displays the content of its own module and does not show content imported from external sources. For the content of sub-modules, only a summary is displayed.
For example:
<img width="1566" height="1868" alt="Image" src="https://github.com/user-attachments/assets/bc581a6b-7ddb-45f3-ada7-81cc140f5e40" />
Perhaps adding a configuration option for this feature is a good approach.
By the way, that label `pkg` only changed the CSS, but essentially it's still label `mod`.
If I messed something up, just let me know, thanks!
关闭于 2025-09-20 1 条评论