A tool for generating API documentation from Clojure source code.
Include the following plugin in your project.clj
file or your global
profile:
:plugins [[codox "0.6.1"]]
Or, if you're using a version of Leiningen prior to 1.7.0:
:dev-dependencies [[codox "0.6.1"]]
Then run:
lein doc
This will generate API documentation in the "doc" subdirectory.
By default Codox looks for source files in the src
subdirectory, but
you can change this by placing the following in your project.clj
file:
:codox {:sources ["path/to/source"]}
To exclude a namespace, use the :exclude
key:
:codox {:exclude my.private.ns}
Sequences work too:
:codox {:exclude [my.private.ns another.private.ns]
To include only one or more namespaces, set them with the :include
key:
;; Again, a single symbol or a collection are both valid
:codox {:include library.core}
:codox {:include [library.core library.io]}
To write output to a directory other than the default doc
directory, use the
:output-dir
key:
:codox {:output-dir "doc/codox"}
To use a different output writer, specify the fully qualified symbol of the
writer function in the :writer
key:
:codox {:writer codox.writer.html/write-docs}
Each of these keywords can be used together, of course.
To force codox to skip an individual public var, add :no-doc true
to the var's metadata. For example,
;; square show up in codox...
(defn square
"Squares the supplied number."
[x])
;; but hidden-square won't.
(defn hidden-square
"Squares the supplied number."
{:no-doc true}
[x]
(* x x))