Serve the overview page as the main page.
()
| 106 | |
| 107 | @app.get("/", response_class=HTMLResponse) |
| 108 | async def index(): |
| 109 | """Serve the overview page as the main page.""" |
| 110 | initialize_globals() |
| 111 | |
| 112 | if DOCS_FOLDER is None: |
| 113 | raise HTTPException(status_code=500, detail="Documentation folder not configured. Please set DOCS_FOLDER environment variable or run with --docs-folder argument.") |
| 114 | |
| 115 | overview_file = Path(DOCS_FOLDER) / "overview.md" |
| 116 | |
| 117 | if not overview_file.exists(): |
| 118 | raise HTTPException(status_code=404, detail="overview.md not found in the documentation folder") |
| 119 | |
| 120 | try: |
| 121 | content = file_manager.load_text(overview_file) |
| 122 | |
| 123 | html_content = markdown_to_html(content) |
| 124 | title = get_file_title(overview_file) |
| 125 | |
| 126 | context = { |
| 127 | "title": title, |
| 128 | "content": html_content, |
| 129 | "navigation": MODULE_TREE, |
| 130 | "current_page": "overview.md" |
| 131 | } |
| 132 | |
| 133 | return HTMLResponse(content=render_template(DOCS_VIEW_TEMPLATE, context)) |
| 134 | |
| 135 | except Exception as e: |
| 136 | raise HTTPException(status_code=500, detail=f"Error reading overview.md: {e}") |
| 137 | |
| 138 | |
| 139 | @app.get("/{filename:path}", response_class=HTMLResponse) |
nothing calls this directly
no test coverage detected