Custom Template for Documentation

Heya !

I was wondering, is there a way to pass a custom template for documentation ? I mean the default one used when generating docs from a module.

The default one seems to be here :

But I don’t see a clear reference as to where to inject a custom template. I would like if possible to avoid modifying the compiler directly.

Thanks :grinning_face_with_smiling_eyes:

Hi @Lygaen,
Can you explain a bit more what you are trying to accomplish? That documentation file is only for the std library for Zig. If you are trying to build your own docs, you may want to look at other codebases that generate docs.
For example, DVUI docs are generated with a build step that uses a custom index.html. I believe this is copied from the zig lib docs and modified for the look and feel of DVUI. You could do something similar. The build.zig file for DVUI has a build step for generating the docs files

1 Like

Heya !

I was trying to modify the default index.html template used during the build process to generate the docs.

Aka. customize the ouput of zig build docs in my project.

What I linked was the current template, which is “embedded” in the compiler and as such doesn’t seem to be modifiable.

I’ll have a look at DVUI which seems to resolve my provlem.

Yeah, you will have to go the DVUI route for that. If you want a custom logo or anything like that, you will need to copy it out and generate it yourself.

1 Like

Thanks ! I’ll try the DVUI way !

That being said, I thing this will be something people run into more in the future. It would be convenient if getEmittedDocs took an optional parameter that allowed for custom templates.

3 Likes