A Brief Beginner's Guide To Clojure
← prev | next →     Top-level ToC     /libs-generating-docs.html     (printable version)

1 Generating API Documentation

To generate regular API docs from a project, see codox. Now supports markdown in your docstrings!

2 Browsing Code alongside Docs

You’ve chosen some libraries which you might be able to use in your project. You’ve added them as dependencies to your project.clj, lein has fetched them for you, and now you’d like to learn more about them.

One way to do that is to use Marginalia to generate docs from the library. Marginalia presents comments and docstrings side-by-side with the library source code.

Install lein-marginalia like so:

cd ~/.lein
touch profiles.clj

and add the following to that file:

{:user {:plugins [[lein-marginalia "0.9.0"]]}}

(or whatever the current version of marginalia is.)

Then (in your project) run the lein subcommand/task provided by that plug-in, like so:

cd path/to/my-proj
lein marg

and point your browser to file://path/to/my-proj/docs/uberdoc.html.

BTW, to make your own programs yield nice docs when using Marginalia, comment them using double-semicolon comment markers and using Markdown formatting. Use Markdown in your docstrings as well.