Skip to content

Commit 01c0f90

Browse files
fix: deep links (#10)
* trying new links * updated links * cleaned
1 parent fbae4a6 commit 01c0f90

File tree

3 files changed

+550
-78
lines changed

3 files changed

+550
-78
lines changed

src/autodoc2/cli.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,14 @@ def _warn(msg: str, type_: WarningSubtypes) -> None:
267267
render_class(db, config, warn=_warn).render_item(mod_name)
268268
)
269269

270-
# Use hyphens in filenames to match Fern slugs
271-
filename = mod_name.replace(".", "-").replace("_", "-")
272-
out_path = output / (filename + render_class.EXTENSION)
270+
# Create nested folder structure based on module path
271+
parts = mod_name.split(".")
272+
# Create directory using all parts (full path)
273+
subdir = output / "/".join(parts)
274+
subdir.mkdir(parents=True, exist_ok=True)
275+
# File is named after the last part
276+
out_path = subdir / (parts[-1] + render_class.EXTENSION)
277+
273278
paths.append(out_path)
274279
if out_path.exists() and out_path.read_text("utf8") == content:
275280
# Don't write the file if it hasn't changed (optimization)

0 commit comments

Comments
 (0)