@@ -313,9 +313,9 @@ def _is_object_ignored(obj: Any) -> bool:
313313 return False
314314
315315
316- def _is_module_ignored (module_name : str , ignored_modules : List [str ]) -> bool :
316+ def _is_module_ignored (module_name : str , ignored_modules : List [str ], private_modules : bool = False ) -> bool :
317317 """Checks if a given module is ignored."""
318- if module_name .split ("." )[- 1 ].startswith ("_" ):
318+ if module_name .split ("." )[- 1 ].startswith ("_" ) and module_name [ 1 ] != "_" and not private_modules :
319319 return True
320320
321321 for ignored_module in ignored_modules :
@@ -1084,6 +1084,7 @@ def generate_docs(
10841084 overview_file : Optional [str ] = None ,
10851085 watermark : bool = True ,
10861086 validate : bool = False ,
1087+ private_modules : bool = False ,
10871088) -> None :
10881089 """Generates markdown documentation for provided paths based on Google-style docstrings.
10891090
@@ -1098,6 +1099,7 @@ def generate_docs(
10981099 overview_file: Filename of overview file. If not provided, no overview file will be generated.
10991100 watermark: If `True`, add a watermark with a timestamp to bottom of the markdown files.
11001101 validate: If `True`, validate the docstrings via pydocstyle. Requires pydocstyle to be installed.
1102+ private_modules: If `True`, includes modules with `_` prefix.
11011103 """
11021104 stdout_mode = output_path .lower () == "stdout"
11031105
@@ -1152,11 +1154,10 @@ def generate_docs(
11521154
11531155 # Generate one file for every discovered module
11541156 for loader , module_name , _ in pkgutil .walk_packages ([path ]):
1155- if _is_module_ignored (module_name , ignored_modules ):
1157+ if _is_module_ignored (module_name , ignored_modules , private_modules ):
11561158 # Add module to ignore list, so submodule will also be ignored
11571159 ignored_modules .append (module_name )
11581160 continue
1159-
11601161 try :
11611162 try :
11621163 mod_spec = importlib .util .spec_from_loader (module_name , loader )
@@ -1236,7 +1237,7 @@ def generate_docs(
12361237 path = obj .__path__ , # type: ignore
12371238 prefix = obj .__name__ + "." , # type: ignore
12381239 ):
1239- if _is_module_ignored (module_name , ignored_modules ):
1240+ if _is_module_ignored (module_name , ignored_modules , private_modules ):
12401241 # Add module to ignore list, so submodule will also be ignored
12411242 ignored_modules .append (module_name )
12421243 continue
0 commit comments