zig icon indicating copy to clipboard operation
zig copied to clipboard

Autodoc: Wrong namespace documentation taken

Open ikskuh opened this issue 2 years ago • 2 comments

Build the following two files and observe the behaviour:

main.zig

//! This is the entry point and root file of microzig.
//! If you do a @import("microzig"), you'll *basically* get this file.
//!
//! But microzig employs a proxy tactic

const std = @import("std");

/// The app that is currently built.
pub const app = @import("app");

app.zig:

//!
//! I AM THE APPLICATION
//!

with zig build-lib main.zig --mod app::app.zig -femit-docs=docs --deps app. Documentation will then look like this:

Zig Version: 0.11.0

ikskuh avatar Sep 30 '23 12:09 ikskuh

i can't find the issue/pr reference atm but I remember seeing something about the behavior of this changing recently. I would try generating the autodocs with master and see if the behavior is the same

nektro avatar Sep 30 '23 21:09 nektro

New autodoc does this currently:

image

image

That's with sources.tar that looks like this:

root/
root/main.zig
app/
app/app.zig

If you do it the other way around, you get:

image

image

(I had to navigate to the hash tag manually to find the other package here)

That's with

app/
app/app.zig
root/
root/main.zig

I think that's closer to what you want, but currently -femit-docs has 2 limitations:

  • It does not (yet?) put all modules into sources.tar, only the root module
  • It does not (yet?) provide the ability to configure which module is the root (first in sources.tar) module

You can, of course, manually construct sources.tar if it suits your use case.

andrewrk avatar Mar 21 '24 00:03 andrewrk