Skip to content

Conversation

@jcalabro
Copy link
Contributor

@jcalabro jcalabro commented Oct 10, 2022

related issue: #12759

Hi! I was looking for a way to familiarize myself a bit more with Zig, and having previously poked with autodoc a bit a month or two ago, I figured I'd grab this quick one-liner to carry forward [src] links on function declaration docs pages.

Here's the result:

Screen Shot 2022-10-09 at 8 53 21 PM

Screen Shot 2022-10-09 at 8 53 44 PM

Which links to this page:

Screen Shot 2022-10-09 at 8 53 32 PM


I do have a couple questions concerning development on autodoc in general not specific to this PR, and happy to move these to issues/discussions if this isn't the appropriate spot for questions:

  1. I'm struggling a bit to understand the development flow of index.html and main.js. From my reading of the docs, I should be able to edit either of these files, run zig build-obj -femit-docs <file>.zig, and it should copy lib/docs/{index.html,main.js} to the newly createddocs/ folder. However, when I make edits to either of the two files then run that, it does not take my edits (it uses whatever is in the master branch). I read the code and ran a quick strace, and I see that it's just doing a copy to a temporary file and renaming. I'm not sure why my edits aren't being applied to those files? Any advice there?

  2. I see that there's a section in the docs about writing type-annoted javascript, but it looks like that was recently removed. Should that section of the docs be deleted?

Thanks!

@jcalabro jcalabro requested a review from kristoff-it as a code owner October 10, 2022 01:05
@kristoff-it
Copy link
Member

Thank you for your contribution!

If you want to chat other people that are working on autodoc, consider joining the main Zig Discord server, we have a dedicated channel (#autodoc) :^)

Here are some answers to your questions:

  1. I'm struggling a bit to understand the development flow of index.html and main.js. From my reading of the docs, I should be able to edit either of these files, run zig build-obj -femit-docs <file>.zig, and it should copy lib/docs/{index.html,main.js} to the newly createddocs/ folder. However, when I make edits to either of the two files then run that, it does not take my edits (it uses whatever is in the master branch). I read the code and ran a quick strace, and I see that it's just doing a copy to a temporary file and renaming. I'm not sure why my edits aren't being applied to those files? Any advice there?

Just to be clear: you're modifying the files in lib/std/docs/, not the ones that get copied in the outputyour-project/doc directory. If so, then your problem is probably that your Zig executable is picking up a different copy of the standard library than the one you think. For example, when you compile Zig, you can do make or make install, with the only difference being that make install will also copy the stdlib in the output directory. The Zig executable looks for the standard library starting from its own directory going upwards and so if you ran make install, it will find it immediately inside the output dir. If you delete that copy of the stdlib (and just run make going forward) it will instead pick up the "authoritative" copy in the Zig repo.

  1. I see that there's a section in the docs about writing type-annoted javascript, but it looks like that was recently removed. Should that section of the docs be deleted?

Yes you're right, I've removed that part.

@kristoff-it kristoff-it merged commit 7877889 into ziglang:master Oct 18, 2022
@jcalabro
Copy link
Contributor Author

it will instead pick up the "authoritative" copy in the Zig repo

I see, that was my mistake. Thanks @kristoff-it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants