|
1 | 1 | #!/usr/bin/env python |
2 | 2 | """Generate the API reference pages for the MQPy package.""" |
3 | 3 |
|
4 | | -import os |
5 | 4 | import sys |
6 | 5 | from pathlib import Path |
7 | 6 |
|
|
18 | 17 | nav = mkdocs_gen_files.Nav() |
19 | 18 |
|
20 | 19 | # Ensure the reference directory exists |
21 | | -os.makedirs(project_dir / "docs" / "reference", exist_ok=True) |
| 20 | +reference_dir = project_dir / "docs" / "reference" |
| 21 | +reference_dir.mkdir(parents=True, exist_ok=True) |
22 | 22 |
|
23 | 23 | # Create an index page with a better layout |
24 | 24 | index_path = Path("reference", "index.md") |
|
44 | 44 | import_path = ".".join(parts) |
45 | 45 |
|
46 | 46 | # Create directory for the documentation |
47 | | - os.makedirs(full_doc_path.parent, exist_ok=True) |
| 47 | + full_doc_path.parent.mkdir(parents=True, exist_ok=True) |
48 | 48 |
|
49 | | - # Write the page content - customized to skip module headers |
| 49 | + # Write the page content |
50 | 50 | with mkdocs_gen_files.open(full_doc_path, "w") as fd: |
51 | | - # Instead of directly using the main import path, create a custom approach |
52 | | - # that doesn't show the module header but still shows classes and functions |
53 | | - # fd.write("---\nhide:\n - toc\n---\n\n") |
54 | 51 | fd.write("<!-- Auto-generated API documentation -->\n\n") |
55 | 52 |
|
56 | | - # Write documentation for classes and functions instead of the module |
57 | | - # This approach avoids generating the module header while still including all content |
| 53 | + # Write documentation for classes and functions |
58 | 54 | fd.write(f"::: {import_path}\n") |
59 | 55 |
|
60 | 56 | # Create title case version of the module name for navigation |
|
0 commit comments