Guidedog Manual 1.0.0-beta.16
Language
On this page
Guidedog / Documentation 1.0.0-beta.16

Document a codebase

A public name needs a contract. We explain its input, its result, its ownership, and the conditions under which it fails. A signature alone is not a manual.

Static extraction architecture

Guidedog extracts API documentation by parsing source files into abstract syntax trees. It never runs or imports our code. So there are no side effects, no runtime to install, and no foreign dependencies to resolve:

Code source trees are parsed into ASTs statically, transformed into virtual API documents, and integrated into cross-references and objects.inv.
Fig. 20 Guidedog static code documentation architecture.

Rust

rust_autoapi_crates = ["../../crates/gd-json", "../../crates/gd-toml"]
rust_autoapi_root = "rustapi"
rust_autoapi_member_order = "source"

Guidedog reads each crate’s source with tree-sitter and follows its module tree the way rustc does: Cargo.toml’s [lib] path, then src/lib.rs or src/main.rs. It does not compile, run, or expand the documented crate. Items made by macros or build scripts are therefore absent. A rust_autoapi_crates entry may also be a single root .rs file or a folder of loose .rs files.

Rustdoc’s rules decide what appears. A pub item reachable through pub modules is documented in its module. pub use of an item from a private module documents it under the re-exported name. #[doc(hidden)] items, #[cfg(test)] modules and tests are left out. rust_autoapi_options adds private-members (everything, with its visibility shown), hidden-members, or noindex.

Doc comments are CommonMark. Guidedog translates them into the page. # Examples and the other headings become rubrics. Fenced code follows rustdoc’s language rules. Intra-doc links ([`Parser`], [Parser::next]) become rust domain references. A link into the crate that names nothing is a rust.autodoc.link warning.

The pages are written under rust_autoapi_root. There is an index page, then one page per documented module (my_crate.rst, my_crate/parser.rst). With rust_autoapi_add_toctree_entry (the default), the index joins the root document’s toctree. With rust_autoapi_generate_api_docs = false, Guidedog reads the settings without generating pages. Domains describes the rust directives and roles. Hand-written pages can use them too.

Odin

odin_autoapi_dirs = ["../../lib"]
odin_autoapi_root = "api"
odin_autoapi_options = ["members", "undoc-members"]

Guidedog reads Odin source by static analysis, across every build target at once. It does not compile or run the documented package. The generated pages join the document graph and object inventory. See Documenting Odin for directives, signatures, and options.

Python

extensions = ["sphinx.ext.autodoc"]
autodoc_source_paths = ["../src"]

Guidedog parses Python source rather than importing it. This avoids import side effects. It also means runtime-generated objects may be absent. When such objects are part of the public interface, we describe them explicitly. See Documenting Python with autodoc for the exact discovery rules.