11using Documenter
22using CTBase
3- using DocumenterMermaid
4- using HTTP, JSON
3+ using Markdown
4+ using MarkdownAST : MarkdownAST
55
6- const CTBaseDocstrings = Base. get_extension (CTBase, :CTBaseDocstrings )
6+ # ═══════════════════════════════════════════════════════════════════════════════
7+ # Configuration
8+ # ═══════════════════════════════════════════════════════════════════════════════
9+ draft = false # Draft mode: if true, @example blocks in markdown are not executed
10+
11+ # ═══════════════════════════════════════════════════════════════════════════════
12+ # Docstrings from external packages
13+ # ═══════════════════════════════════════════════════════════════════════════════
14+ const DocumenterReference = Base. get_extension (CTBase, :DocumenterReference )
715
8- # to add docstrings from external packages
916Modules = [Base]
1017for Module in Modules
1118 isnothing (DocMeta. getdocmeta (Module, :DocTestSetup )) &&
1219 DocMeta. setdocmeta! (Module, :DocTestSetup , :(using $ Module); recursive= true )
1320end
1421
22+ # ═══════════════════════════════════════════════════════════════════════════════
23+ # Repository configuration
24+ # ═══════════════════════════════════════════════════════════════════════════════
1525repo_url = " github.com/control-toolbox/CTBase.jl"
1626
17- API_PAGES = [" ctbase.md" , " default.md" , " description.md" , " docstrings.md" , " exception.md" ]
18-
27+ # ═══════════════════════════════════════════════════════════════════════════════
28+ # Build documentation
29+ # ═══════════════════════════════════════════════════════════════════════════════
1930makedocs (;
20- warnonly= [:cross_references , :autodocs_block ],
31+ draft= draft,
32+ remotes= nothing , # Disable remote links. Needed for DocumenterReference
33+ warnonly= true ,
2134 sitename= " CTBase.jl" ,
2235 format= Documenter. HTML (;
2336 repolink= " https://" * repo_url,
@@ -28,8 +41,71 @@ makedocs(;
2841 asset (" https://control-toolbox.org/assets/js/documentation.js" ),
2942 ],
3043 ),
31- pages= [" Introduction" => " index.md" , " API" => API_PAGES],
44+ pages= [
45+ " Introduction" => " index.md" ,
46+ " API Reference" => [
47+ CTBase. automatic_reference_documentation (;
48+ subdirectory= " ." ,
49+ modules= [CTBase],
50+ exclude= Symbol[:include , :eval ],
51+ public= false ,
52+ private= true ,
53+ title= " CTBase" ,
54+ title_in_menu= " CTBase" , # optionnel
55+ filename= " ctbase" ,
56+ source_files= [abspath (joinpath (@__DIR__ , " .." , " src" , " CTBase.jl" ))],
57+ ),
58+ CTBase. automatic_reference_documentation (;
59+ subdirectory= " ." ,
60+ modules= [CTBase],
61+ exclude= Symbol[:include , :eval ],
62+ public= false ,
63+ private= true ,
64+ title= " Default" ,
65+ title_in_menu= " Default" , # optionnel
66+ filename= " default" ,
67+ source_files= [abspath (joinpath (@__DIR__ , " .." , " src" , " default.jl" ))],
68+ ),
69+ CTBase. automatic_reference_documentation (;
70+ subdirectory= " ." ,
71+ modules= [CTBase],
72+ exclude= Symbol[:include , :eval ],
73+ public= false ,
74+ private= true ,
75+ title= " Description" ,
76+ title_in_menu= " Description" , # optionnel
77+ filename= " description" ,
78+ source_files= [abspath (joinpath (@__DIR__ , " .." , " src" , " description.jl" ))],
79+ ),
80+ CTBase. automatic_reference_documentation (;
81+ subdirectory= " ." ,
82+ modules= [CTBase],
83+ doc_modules= [Base], # pour inclure Base.showerror
84+ exclude= Symbol[:include , :eval ],
85+ public= false ,
86+ private= true ,
87+ title= " Exception" ,
88+ title_in_menu= " Exception" , # optionnel
89+ filename= " exception" ,
90+ source_files= [abspath (joinpath (@__DIR__ , " .." , " src" , " exception.jl" ))],
91+ ),
92+ CTBase. automatic_reference_documentation (;
93+ subdirectory= " ." ,
94+ modules= [CTBase],
95+ exclude= Symbol[:include , :eval ],
96+ public= false ,
97+ private= true ,
98+ title= " Utils" ,
99+ title_in_menu= " Utils" , # optionnel
100+ filename= " utils" ,
101+ source_files= [abspath (joinpath (@__DIR__ , " .." , " src" , " utils.jl" ))],
102+ ),
103+ ],
104+ ],
32105 checkdocs= :none ,
33106)
34107
108+ # ═══════════════════════════════════════════════════════════════════════════════
109+ # Deploy documentation to GitHub Pages
110+ # ═══════════════════════════════════════════════════════════════════════════════
35111deploydocs (; repo= repo_url * " .git" , devbranch= " main" )
0 commit comments