Writing and generating documentation
Sam Estep edited this page Feb 1, 2022
·
12 revisions
We use typedoc. To generate docs locally, run in penrose-web
:
typedoc --mode modules --out docs src --includeDeclarations --ignoreCompilerErrors --exclude "**/*__*/**" --exclude "**/*.test.tsx" --exclude "**/node_modules/**"
npx serve docs
Docs are auto-served here by GitHub Actions on every push to master
.
- TODO: We should have an
npm run docs
command too.
Penrose uses haddock to automatically generate documentation. We follow Haddock's specific markup language when documenting our code. Here is a nice cheat sheet to keep around when writing haddock comments.
- If you use
cabal
:
cabal haddock --hyperlink-source --executables
--html-location='http://hackage.haskell.org/package/penrose/docs'
--haddock-options=--no-print-missing-docs
- If you use
stack
: Note that you have to make suresrc
is clean and in sync withupstream
because it will parse all.hs
files insrc
even if they are untracked. You can run the following command or executescript/mkdoc.sh
stack exec -- haddock --html src/*.hs --hyperlinked-source --odir=dist/docs
- After the generation,
haddock
would report a path toindex.html
of the documentation site relative toTOP
- By default, all top-level functions will appear in the documentation page. Adding
{-# OPTIONS_HADDOCK prune #-}
will hide undocumented ones and only show documented ones.
Found a problem or got a suggestion? Please open a GitHub issue and tag it with documentation
!