puqeko / zig2dash

Generate a .docset from the Zig Language Reference and the Zig Standard Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Zig 2 Dash

Create a static .docset of Zig language documentation for use in Dash as per this guide.

Produces .tgz for upload as a Dash User Contribution but could also be used anywhere that accepts a .docset.

To include:

Zig currently presents its Standard Library docs via a dynamic webapp which is unusable in static API browsers like Dash. Writing a generator that uses the json dump included with the webapp requires an understanding of Zig Intermediate Representation I don't have and, given the project is under heavy development, any such script would likely break frequently. It does not seem like the development team are interested in an option to output static html docs in the near future. However, when the format of json dump becomes more stable it may be more suitible for interfacing with directly.

Temporary work around: load the webapp from ziglang.org via jsdom, traverse each hashlink, wait for the next animation frame, then export the generated html as a page, replacing links as needed. Allows for changes to zig autodoc (which is experimental) without knowing about ZIR. It's slow but seems to do the job.

Setup

With Node.

To install dependencies:

node i

To run:

node index.js

Takes about 40 mins to run defaults on my machine.

About

Generate a .docset from the Zig Language Reference and the Zig Standard Library


Languages

Language:JavaScript 100.0%