1+
2+ load ("@rules_docs//docgen:defs.bzl" , "docs" )
3+ load ("@mkdocs//:defs.bzl" , "mkdocs_build" , "mkdocs_config" , "mkdocs_serve" )
4+ load ("@rules_python//python:pip.bzl" , "compile_pip_requirements" )
5+
6+ compile_pip_requirements (
7+ name = "requirements" ,
8+ src = "pyproject.toml" ,
9+ requirements_txt = "requirements.txt" ,
10+ )
11+
12+ docs (
13+ name = "other_docs" ,
14+ entry = "api-reference.md" ,
15+ data = ["openapi.yaml" ],
16+ readme_content = "API Reference" ,
17+ )
18+
19+ # Main documentation configuration
20+ docs (
21+ name = "docs" ,
22+ nav = {
23+ "README.md" : "Home" ,
24+ ":other_docs" : "API Reference (Redoc)" ,
25+ },
26+ rewrite_path = "examples/swagger" ,
27+ visibility = ["//visibility:public" ],
28+ )
29+
30+ # Generate mkdocs configuration
31+ mkdocs_config (
32+ name = "mkdocs_config" ,
33+ docs = ":docs" ,
34+ mkdocs_base = "mkdocs.tpl.yaml" ,
35+ )
36+
37+ # Build documentation site
38+ mkdocs_build (
39+ name = "mkdocs" ,
40+ config = ":mkdocs_config" ,
41+ docs = [":docs" ],
42+ site_dir = "site" ,
43+ visibility = ["//visibility:public" ],
44+ )
45+
46+ # Serve documentation locally for development
47+ # Recommended: run with ibazel for auto-reload on changes
48+ mkdocs_serve (
49+ name = "mkdocs.serve" ,
50+ config = ":mkdocs_config" ,
51+ docs = [":docs" ],
52+ visibility = ["//visibility:public" ],
53+ )
0 commit comments