@@ -153,8 +153,9 @@ def generate_class_page(self, class_name: str, class_obj: Any) -> Path:
153153 # e.g., plotly.graph_objs.bar.Marker -> bar-package/Marker.md
154154 parent_dir = self .output_dir / f"{ parent_parts [0 ]} -package"
155155 else :
156- # e.g., plotly.graph_objs.bar.hoverlabel.Font -> bar/hoverlabel-package/Font.md
157- parent_dir = self .output_dir / Path (* parent_parts [:- 1 ]) / f"{ parent_parts [- 1 ]} -package"
156+ # e.g., plotly.graph_objs.bar.hoverlabel.Font -> bar-package/hoverlabel-package/Font.md
157+ parent_dirs_with_suffix = [part + '-package' for part in parent_parts [:- 1 ]]
158+ parent_dir = self .output_dir / Path (* parent_dirs_with_suffix ) / f"{ parent_parts [- 1 ]} -package"
158159 file_path = parent_dir / f"{ parts [- 1 ]} .md"
159160 else :
160161 file_path = self .output_dir / f"{ parts [- 1 ]} .md"
@@ -198,8 +199,9 @@ def generate_package_index(self, package_name: str, package_obj: Any) -> Path:
198199 # Add -package suffix to avoid conflicts with class names
199200 package_name_with_suffix = f"{ relative_parts [- 1 ]} -package"
200201 if len (relative_parts ) > 1 :
201- # For nested packages, replace the last part with the suffixed version
202- file_path = self .output_dir / Path (* relative_parts [:- 1 ]) / package_name_with_suffix / "index.md"
202+ # For nested packages, all parent directories should also have -package suffix
203+ parent_parts = [part + '-package' for part in relative_parts [:- 1 ]]
204+ file_path = self .output_dir / Path (* parent_parts ) / package_name_with_suffix / "index.md"
203205 else :
204206 # For top-level packages
205207 file_path = self .output_dir / package_name_with_suffix / "index.md"
0 commit comments