|
| 1 | +--- |
| 2 | +title: navigation |
| 3 | +sidebarTitle: navigation |
| 4 | +--- |
| 5 | + |
| 6 | +# `mdxify.navigation` |
| 7 | + |
| 8 | + |
| 9 | +Navigation structure management. |
| 10 | + |
| 11 | +## Functions |
| 12 | + |
| 13 | +### `get_all_documented_modules` <sup><a href="https://github.com/zzstoatzz/mdxify/blob/main/src/mdxify/navigation.py#L11" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> |
| 14 | + |
| 15 | +```python |
| 16 | +get_all_documented_modules(output_dir: Path) -> list[str] |
| 17 | +``` |
| 18 | + |
| 19 | + |
| 20 | +Get all modules that have documentation files. |
| 21 | + |
| 22 | + |
| 23 | +### `build_hierarchical_navigation` <sup><a href="https://github.com/zzstoatzz/mdxify/blob/main/src/mdxify/navigation.py#L29" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> |
| 24 | + |
| 25 | +```python |
| 26 | +build_hierarchical_navigation(generated_modules: list[str], output_dir: Path, docs_root: Path | None = None, skip_empty_parents: bool = False) -> list[dict[str, Any]] |
| 27 | +``` |
| 28 | + |
| 29 | + |
| 30 | +Build a hierarchical navigation structure from flat module names. |
| 31 | + |
| 32 | +**Args:** |
| 33 | +- `generated_modules`: List of module names |
| 34 | +- `output_dir`: Directory where MDX files are written |
| 35 | +- `docs_root`: Root directory for docs (to calculate relative paths). If None, paths are relative to output_dir |
| 36 | +- `skip_empty_parents`: Whether to skip empty parent modules |
| 37 | + |
| 38 | +Returns a list of navigation entries where each entry is either: |
| 39 | +- A string (the path to the MDX file without extension) |
| 40 | +- A dict with "group" and "pages" keys for modules with submodules |
| 41 | + |
| 42 | + |
| 43 | +### `find_mdxify_placeholder` <sup><a href="https://github.com/zzstoatzz/mdxify/blob/main/src/mdxify/navigation.py#L174" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> |
| 44 | + |
| 45 | +```python |
| 46 | +find_mdxify_placeholder(obj: Any, path: list[str] | None = None) -> tuple[Any, list[str]] | None |
| 47 | +``` |
| 48 | + |
| 49 | + |
| 50 | +Recursively find the $mdxify placeholder in a nested structure. |
| 51 | + |
| 52 | +Returns the parent container and path to the placeholder, or None if not found. |
| 53 | + |
| 54 | + |
| 55 | +### `find_mdxify_anchor_or_group` <sup><a href="https://github.com/zzstoatzz/mdxify/blob/main/src/mdxify/navigation.py#L206" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> |
| 56 | + |
| 57 | +```python |
| 58 | +find_mdxify_anchor_or_group(docs_config: dict[str, Any], target_name: str) -> tuple[Any, list[str]] | None |
| 59 | +``` |
| 60 | + |
| 61 | + |
| 62 | +Find an existing mdxify-managed anchor or group in the navigation. |
| 63 | + |
| 64 | +Returns the pages list and path to it, or None if not found. |
| 65 | + |
| 66 | + |
| 67 | +### `find_mdxify_anchor` <sup><a href="https://github.com/zzstoatzz/mdxify/blob/main/src/mdxify/navigation.py#L266" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> |
| 68 | + |
| 69 | +```python |
| 70 | +find_mdxify_anchor(docs_config: dict[str, Any], anchor_name: str) -> tuple[Any, list[str]] | None |
| 71 | +``` |
| 72 | + |
| 73 | + |
| 74 | +Find an existing mdxify-managed anchor in the navigation. |
| 75 | + |
| 76 | +This function is kept for backwards compatibility but now searches for both anchors and groups. |
| 77 | + |
| 78 | +Returns the pages list and path to it, or None if not found. |
| 79 | + |
| 80 | + |
| 81 | +### `update_docs_json` <sup><a href="https://github.com/zzstoatzz/mdxify/blob/main/src/mdxify/navigation.py#L276" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> |
| 82 | + |
| 83 | +```python |
| 84 | +update_docs_json(docs_json_path: Path, generated_modules: list[str], output_dir: Path, regenerate_all: bool = False, skip_empty_parents: bool = False, anchor_name: str = 'SDK Reference') -> bool |
| 85 | +``` |
| 86 | + |
| 87 | + |
| 88 | +Update docs.json with generated module documentation. |
| 89 | + |
| 90 | +First looks for an existing anchor or group with the given name to update. |
| 91 | +If not found, looks for {"$mdxify": "generated"} placeholder. |
| 92 | + |
| 93 | +**Args:** |
| 94 | +- `docs_json_path`: Path to docs.json file |
| 95 | +- `generated_modules`: List of module names that were generated |
| 96 | +- `output_dir`: Directory where MDX files are written |
| 97 | +- `regenerate_all`: If True, replace all content; if False, merge with existing |
| 98 | +- `skip_empty_parents`: Whether to skip empty parent modules |
| 99 | +- `anchor_name`: Name of the navigation anchor or group to update (searches both) |
| 100 | +Note\: Despite the parameter name, this searches for both anchors and groups. |
| 101 | + |
| 102 | +Returns True if successfully updated, False otherwise. |
| 103 | + |
0 commit comments