Example how to build haddocks for multiple cabal packages, or check the haddock manual
${GHC_9}
is a path to `ghc-9.0.1``${HADDOCK}
is a path tohaddock
build from this branch (PR #1277).- You might need to add
--haddock-options: --lib PATH
, wherePATH
is a path to haddocks resource directory (haddock-api/resources), also don't forget to add it to thehaddock
command below.
To build the docs directory:
rm rf docs/*
cabal haddock --with-compiler GHC_9 \
--with-haddock=${HADDOCK} \
--haddock-html \
--haddock-quickjump \
--haddock-option='--use-index=../doc-index.html' \
--haddock-option='--use-contents=../index.html' \
--haddock-option='--base-url=..' \
all
cp -r dist-newstyle/build/x86_64-linux/ghc-9.0.1/package-a-0.1.0.0/doc/html/package-a/ docs
cp -r dist-newstyle/build/x86_64-linux/ghc-9.0.1/package-b-0.1.0.0/doc/html/package-b/ docs
${HADDOCK} -o docs --quickjump --gen-index --gen-contents \
--read-interface=package-a,docs/package-a/package-a.haddock \
--read-interface=package-b,docs/package-b/package-b.haddock
To include base
documentation, copy base
docs from ~/.ghcup/ghc/9.0.1/share/doc/ghc-9.0.1/html/librarires/base-4.15.0.0
to docs/base
and also include --read-interface
option:
${HADDOCK} -o docs --quickjump --gen-index --gen-contents --read-interface=package-a,docs/package-a/package-a.haddock --read-interface=package-b,docs/package-b/package-b.haddock --read-interface=base,${HOME}/.ghcup/ghc/9.0.1/share/doc/ghc-9.0.1/html/libraries/base-4.15.0.0/base.haddock
And serve docs
with some http server, e.g. http-server docs
.
--read-interface=PATH,...
: the PATH
must be relative url of a package it points to (relative to docs
directory).