35 lines
805 B
Python
35 lines
805 B
Python
from typing import Dict, List, Any
|
|
from pathlib import Path
|
|
|
|
from docforge.nav.resolver import ResolvedNav
|
|
|
|
|
|
class MkDocsNavEmitter:
|
|
"""
|
|
Converts a ResolvedNav into MkDocs-compatible `nav` data.
|
|
"""
|
|
|
|
def emit(self, nav: ResolvedNav) -> List[Dict[str, Any]]:
|
|
"""
|
|
Emit a structure suitable for insertion into mkdocs.yml.
|
|
|
|
Example return value:
|
|
|
|
[
|
|
{"Home": "openapi_first/index.md"},
|
|
{
|
|
"Core": [
|
|
{"OpenAPI-First App": "openapi_first/app.md"},
|
|
...
|
|
]
|
|
}
|
|
]
|
|
"""
|
|
...
|
|
|
|
def _to_relative(self, path: Path, docs_root: Path | None) -> str:
|
|
"""
|
|
Convert a filesystem path to a docs-relative path.
|
|
"""
|
|
...
|