"""Unit: document viewer (phase 10). Python side: * ``doc_format`` — format from the path suffix (incl. ``.markdown`` and the no-suffix fallback); * the content endpoint's 200/404 mapping — tested WITHOUT a database by stubbing the session via FastAPI's dependency override (unknown pairs and traversal-style paths map to 404 ``{detail: "document not found"}``; known pairs map to the full ``DocContent`` shape). Frontend side: * the viewer URL builder — its real query-encoding behavior (paths with spaces/slashes) executed under node when available, plus source pins that run everywhere; * the shared-renderer extraction — ``markdown.js`` holds the renderer, loaded by BOTH pages via a relative ``', html), ( f"{page} must load markdown.js via a relative " + "\\n\\n**bold** and `code`'));" ) html = out.strip() assert "