nav submodule

This commit is contained in:
2026-01-20 21:22:28 +05:30
parent 869b1730c4
commit 726e7ca6d2
12 changed files with 493 additions and 0 deletions

24
docforge/nav/mkdocs.py Normal file
View File

@@ -0,0 +1,24 @@
from __future__ import annotations
from typing import Any, Dict, List
from docforge.nav.resolver import ResolvedNav
class MkDocsNavEmitter:
"""Emit MkDocs-compatible nav structure."""
def emit(self, nav: ResolvedNav) -> List[Dict[str, Any]]:
result: List[Dict[str, Any]] = []
if nav.home:
result.append({"Home": nav.home})
for group, paths in nav.groups.items():
entries: List[Dict[str, str]] = []
for path in paths:
title = path.stem.replace("_", " ").title()
entries.append({title: path.as_posix()})
result.append({group: entries})
return result