File tree 5 files changed +50
-5
lines changed
5 files changed +50
-5
lines changed File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ """Generate the code reference pages."""
2
+
3
+ # Recipe to break up API docs into multiple pages from
4
+ # https://mkdocstrings.github.io/recipes/#automatic-code-reference-pages
5
+
6
+ from pathlib import Path
7
+
8
+ import mkdocs_gen_files
9
+
10
+ api_nav = mkdocs_gen_files .Nav ()
11
+
12
+ repo_root = Path (__file__ ).parent .parent .parent
13
+ src = repo_root / "src"
14
+
15
+ for path in sorted (src .rglob ("*.py" )):
16
+ module_path = path .relative_to (src ).with_suffix ("" )
17
+ doc_path = path .relative_to (src ).with_suffix (".md" )
18
+ full_doc_path = Path ("gen_reference" , doc_path )
19
+
20
+ parts = tuple (module_path .parts )
21
+
22
+ if parts [- 1 ] == "__init__" :
23
+ parts = parts [:- 1 ]
24
+ elif parts [- 1 ] == "__main__" :
25
+ continue
26
+
27
+ api_nav [parts ] = doc_path .as_posix ()
28
+
29
+ with mkdocs_gen_files .open (full_doc_path , "w" ) as fd :
30
+ identifier = "." .join (parts )
31
+ print ("::: " + identifier , file = fd )
32
+ # TODO: add the options I want. See my old manual api*.md files.
33
+
34
+ mkdocs_gen_files .set_edit_path (full_doc_path , path .relative_to (repo_root ))
35
+
36
+
37
+ with mkdocs_gen_files .open ("gen_reference/API_NAV.md" , "w" ) as nav_file :
38
+ nav_file .writelines (api_nav .build_literate_nav ())
Original file line number Diff line number Diff line change @@ -44,6 +44,11 @@ hooks:
44
44
45
45
plugins :
46
46
- search :
47
+ - gen-files :
48
+ scripts :
49
+ - docs/scripts/gen_api_pages.py
50
+ - literate-nav :
51
+ nav_file : ' API_NAV.md'
47
52
- macros :
48
53
include_dir : ' docs/examples'
49
54
on_error_fail : true
77
82
- Overview : ' library-overview.md'
78
83
- Auth Client Configuration : ' configuration.md'
79
84
- Built-in Injection : ' built-ins.md'
80
- - API Reference :
81
- - Planet Auth : ' api-planet-auth.md'
82
- - Planet Auth Utils : ' api-planet-auth-utils.md'
85
+ # - API Reference:
86
+ # - Planet Auth: 'api-planet-auth.md'
87
+ # - Planet Auth Utils: 'api-planet-auth-utils.md'
88
+ - API Reference : gen_reference/
83
89
- Examples :
84
90
- Installation : ' examples-installation.md'
85
91
- CLI : ' examples-cli.md'
Original file line number Diff line number Diff line change @@ -48,10 +48,11 @@ docs = [
48
48
# https://github.com/mkdocstrings/mkdocstrings/discussions/743
49
49
" mkdocstrings[python] == 0.28.3" ,
50
50
" mkdocs-click" ,
51
+ " mkdocs-gen-files" ,
52
+ " mkdocs-literate-nav" ,
53
+ " mkdocs-linkcheck" ,
51
54
" mkdocs-material == 9.6.12" , # Upgrades may interact with docs/custom_theme
52
55
" mkdocs-macros-plugin" ,
53
- " mkdocs-linkcheck" ,
54
- # "linkcheckmd",
55
56
]
56
57
examples = [
57
58
" flask" ,
You can’t perform that action at this time.
0 commit comments