Skip to content

Generating and deploying coqdoc HTML documentation

Karl Palmskog edited this page Jan 16, 2020 · 3 revisions

This is a short tutorial on how to continuously generate and deploy HTML documentation for a Coq project by leveraging the coqdoc tool, GitHub Pages, and CoqdocJS scripts adapted for coq-community.

The idea is that the source HTML files produced by coqdoc, which are deployed to GitHub's servers along with custom pages, live in the gh-pages branch of the repository, e.g., for a release named v1.1, in the docs/v1.1/coqdoc directory of this branch. Since HTML is not particularly compact, maintainers are recommended to only update the gh-pages branch with new coqdoc output when a new project version is released, to keep repository size small.

Cloning CoqdocJS

The files in CoqdocJS are meant to be copied into other repositories. Here, we assume the CoqdocJS repository is cloned from the directory above the project's repository directory:

git clone https://github.com/palmskog/coqdocjs.git

Adding Makefile tasks for CoqdocJS

We assume a delegating top-level Makefile using coq_makefile as described here.

Go to the repository and copy the CoqdocJS file Makefile.coq.local :

cp ../coqdocjs/Makefile.coq.local .

If you already have a Makefile.coq.local, you will have to manually merge it with the contents of the file from CoqdocJS.

Adding scripts and index HTML file

Copy the resources directory from CoqdocJS into your project:

cp -r ../coqdocjs/resources .

It may also be worthwhile to store a generic website index page in the directory. For example, one can use a corresponding mustache template to generate a basic Markdown file:

mustache meta.yml ../templates/index.md.mustache > resources/index.md

When index.md is as required, one can generate the corresponding index.html using pandoc:

pandoc -s -o resources/index.html resources/index.md

Finally, commit all new files to your repo.

Generating coqdoc HTML

The contents is generated as follows:

make coqdoc

Creating an empty gh-pages branch

Deploying coqdoc HTML on GitHub Pages

Example project

For an example repository following the above conventions, see the Huffman project, and in particular its deployed website and coqdoc documentation.