Zig Autodoc : exclude anonymous imports?

Try to define a simple zig source for emitting docs. I am doing this mostly because I don’t want to wait for documentation generation when testing.

    // docs:
    const doc_tests = b.addTest(.{
        .root_source_file = .{ .path = "src/root.zig" },
        .target = target,
        .optimize = optimize,
    });
    const install_docs = b.addInstallDirectory(.{
        .source_dir = doc_tests.getEmittedDocs(),
        .install_dir = .prefix,
        .install_subdir = "docs",
    });
    const docs_step = b.step("docs", "Generate documentation");
    docs_step.dependOn(&install_docs.step);

install_docs creates the directory zig-out/docs
for doc_tests don’t use your full module set, but a simpler zig source that includes the wanted documentation.

2 Likes