fix: make MkDocs generation filesystem-complete and package-aware

- Add filesystem-based module discovery via `discover_module_paths`
- Decouple documentation coverage from Python import behavior
- Ensure GriffeLoader receives a full module list instead of a single root
- Make MkDocs renderer level-agnostic using global package detection
- Emit `index.md` only for true packages, suppress `<package>.md`
- Mirror full dotted module hierarchy into nested docs directories
- Update CLI, exports, and type stubs to expose discovery helper
- Align tests with filesystem-driven module coverage

This fixes missing docs for submodules and removes invalid package `.md` files.
This commit is contained in:
2026-01-20 23:25:56 +05:30
parent 2e5d330fca
commit dca19caaf3
9 changed files with 120 additions and 41 deletions

View File

@@ -1,17 +1,17 @@
from pathlib import Path
from typing import Set
from docforge.model import Project
from docforge.renderers.base import DocRenderer
from docforge.model import Project, Module
class MkDocsRenderer:
"""MkDocs source generator using mkdocstrings."""
name: str
def generate_sources(
def generate_sources(self, project: Project, out_dir: Path) -> None: ...
def _write_module(
self,
project: Project,
module: Module,
packages: Set[str],
out_dir: Path,
) -> None:
"""Generate Markdown files with mkdocstrings directives."""
) -> None: ...
def _render_markdown(self, title: str, module_path: str) -> str: ...