Haddock: better support for multiple components
Recently I enhanced support for publishing haddocks of multiple
this pull request).
It will be available in next release of
GHC-9.0.2). Note that there is still room for improvement (e.g.
external links to hackage). Currently, there's no tooling support, so it might
still feel a bit hacky.
First one needs to compile haddocks of all the components, which can be done
cabal haddock --haddock-html \ --haddock-quickjump \ --haddock-option="--use-index=../doc-index.html" \ --haddock-option="--use-contents=../index.html" \ --haddock-option="--base-url=.." \ all
The second step is to copy all the haddocks to a common directory, e.g.
docs folder. To compile the contents page (the haddock entry
page), index with support of quickjump one can run:
haddock -o docs \ --quickjump \ --gen-index \ --gen-contents \ --read-interface=package-a,docs/package-a/package-a.haddockwhere one needs to list each component with
--read-interfacepointing to the compiled
The docs directory can be served with a local http server or
github-pages. Check out an example project
here. Note that some
settings are hidden in its
file. Its haddocks, which also include haddocks of
are available here.