MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / index

Function index

codewiki/src/fe/visualise_docs.py:108–136  ·  view source on GitHub ↗

Serve the overview page as the main page.

()

Source from the content-addressed store, hash-verified

106
107@app.get("/", response_class=HTMLResponse)
108async 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)

Callers

nothing calls this directly

Calls 5

initialize_globalsFunction · 0.85
markdown_to_htmlFunction · 0.85
get_file_titleFunction · 0.85
render_templateFunction · 0.85
load_textMethod · 0.80

Tested by

no test coverage detected