Sobeston / zig.guide

Repo for https://zig.guide content. Get up to speed with Zig quickly.
https://zig.guide
MIT License
688 stars 178 forks source link

Generating documentation #253

Open ivanstepanovftw opened 3 months ago

ivanstepanovftw commented 3 months ago

I have skill issue - how to open generated docs in browser locally? https://zig.guide/build-system/generating-documentation/

ivanstepanovftw commented 3 months ago
// Docs
const docs_step = b.addInstallDirectory(.{
    .source_dir = lib_unit_tests.getEmittedDocs(),
    .install_dir = .prefix,
    .install_subdir = "docs",
});
docs_step.step.dependOn(&exe.step);

const docs = b.step("docs", "Generate documentation");
docs.dependOn(&docs_step.step);

zig build docs generates docs in "zig-out/docs/" directory. To open it need to serve HTTP server by using i.e. Python: python -m http.server -d zig-out/docs &