Skip to content

Commit 579484a

Browse files
committed
add docs
1 parent 5cd89f1 commit 579484a

File tree

7 files changed

+473
-0
lines changed

7 files changed

+473
-0
lines changed

docs/mdxify-cli.mdx

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
title: cli
3+
sidebarTitle: cli
4+
---
5+
6+
# `mdxify.cli`
7+
8+
9+
CLI interface for mdxify.
10+
11+
## Functions
12+
13+
### `remove_excluded_files` <sup><a href="https://github.com/zzstoatzz/mdxify/blob/main/src/mdxify/cli.py#L81" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
14+
15+
```python
16+
remove_excluded_files(output_dir: Path, exclude_patterns: list[str]) -> int
17+
```
18+
19+
20+
Remove existing MDX files for excluded modules.
21+
22+
Returns the number of files removed.
23+
24+
25+
### `main` <sup><a href="https://github.com/zzstoatzz/mdxify/blob/main/src/mdxify/cli.py#L108" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
26+
27+
```python
28+
main()
29+
```
30+
31+
## Classes
32+
33+
### `SimpleProgressBar` <sup><a href="https://github.com/zzstoatzz/mdxify/blob/main/src/mdxify/cli.py#L19" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
34+
35+
36+
A simple progress bar using only built-in Python.
37+
38+
39+
**Methods:**
40+
41+
#### `update` <sup><a href="https://github.com/zzstoatzz/mdxify/blob/main/src/mdxify/cli.py#L30" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
42+
43+
```python
44+
update(self, n: int = 1)
45+
```
46+
47+
Update progress by n steps.
48+
49+
50+
#### `finish` <sup><a href="https://github.com/zzstoatzz/mdxify/blob/main/src/mdxify/cli.py#L73" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
51+
52+
```python
53+
finish(self)
54+
```
55+
56+
Mark progress as complete.
57+

docs/mdxify-discovery.mdx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: discovery
3+
sidebarTitle: discovery
4+
---
5+
6+
# `mdxify.discovery`
7+
8+
9+
Module discovery utilities.
10+
11+
## Functions
12+
13+
### `get_module_source_file` <sup><a href="https://github.com/zzstoatzz/mdxify/blob/main/src/mdxify/discovery.py#L10" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
14+
15+
```python
16+
get_module_source_file(module_name: str) -> Optional[Path]
17+
```
18+
19+
20+
Get the source file path for a module.
21+
22+
23+
### `find_all_modules` <sup><a href="https://github.com/zzstoatzz/mdxify/blob/main/src/mdxify/discovery.py#L21" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
24+
25+
```python
26+
find_all_modules(root_module: str) -> list[str]
27+
```
28+
29+
30+
Find all modules under a root module.
31+
32+
33+
### `should_include_module` <sup><a href="https://github.com/zzstoatzz/mdxify/blob/main/src/mdxify/discovery.py#L38" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
34+
35+
```python
36+
should_include_module(module_name: str, include_internal: bool = False) -> bool
37+
```
38+
39+
40+
Check if a module should be included in the API documentation.
41+

docs/mdxify-formatter.mdx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: formatter
3+
sidebarTitle: formatter
4+
---
5+
6+
# `mdxify.formatter`
7+
8+
9+
Docstring formatting utilities.
10+
11+
## Functions
12+
13+
### `format_docstring_with_griffe` <sup><a href="https://github.com/zzstoatzz/mdxify/blob/main/src/mdxify/formatter.py#L16" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
14+
15+
```python
16+
format_docstring_with_griffe(docstring: str) -> str
17+
```
18+
19+
20+
Format a docstring using Griffe for better structure.
21+
22+
23+
### `escape_mdx_content` <sup><a href="https://github.com/zzstoatzz/mdxify/blob/main/src/mdxify/formatter.py#L99" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
24+
25+
```python
26+
escape_mdx_content(content: str) -> str
27+
```
28+
29+
30+
Escape content for MDX to prevent parsing issues, but not inside code blocks.
31+

docs/mdxify-generator.mdx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: generator
3+
sidebarTitle: generator
4+
---
5+
6+
# `mdxify.generator`
7+
8+
9+
MDX documentation generation.
10+
11+
## Functions
12+
13+
### `is_module_empty` <sup><a href="https://github.com/zzstoatzz/mdxify/blob/main/src/mdxify/generator.py#L10" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
14+
15+
```python
16+
is_module_empty(module_path: Path) -> bool
17+
```
18+
19+
20+
Check if a module documentation file indicates it's empty.
21+
22+
23+
### `generate_mdx` <sup><a href="https://github.com/zzstoatzz/mdxify/blob/main/src/mdxify/generator.py#L22" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
24+
25+
```python
26+
generate_mdx(module_info: dict[str, Any], output_file: Path, repo_url: Optional[str] = None, branch: str = 'main', root_module: Optional[str] = None) -> None
27+
```
28+
29+
30+
Generate MDX documentation from module info.
31+
32+
**Args:**
33+
- `module_info`: Parsed module information
34+
- `output_file`: Path to write the MDX file
35+
- `repo_url`: GitHub repository URL for source links
36+
- `branch`: Git branch name for source links
37+
- `root_module`: Root module name for finding relative paths
38+

docs/mdxify-navigation.mdx

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
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

Comments
 (0)