dive deeper into your code
deps.edn
, make a new gen-docs
alias with hydrox
and the old version of core.match
(used by hydrox
to parse html): :aliases {
:gen-docs {:extra-deps
{parkside-securities/hydrox {:mvn/version "0.10.5"}
org.clojure/core.match {:mvn/version "0.2.2"}}
}
:documentation
map in your deps.edn
. This is how Hydrox knows where to put generated documents::documentation {:site "test-docs"
:output "docs"
:template {:path "template"
:copy ["assets"]
:defaults {:template "article.html"
:navbar [:file "partials/navbar.html"]
:dependencies [:file "partials/deps-web.html"]
:navigation :navigation
:article :article}}
:paths ["test"]
:files {"test-docs-name"
{:input "test/your_app/docs_test.clj"
:title "Your App Tests"
:subtitle "change these for your app."}}}}
docs
folder in your project. Intialize with a docs/.gitignore
that includes the following lines:*
*/
!.gitignore
# docs contents are generated by hydrox and copied to docker image at runtime
# generated artifacts shouldn't be checked into git in general.
Create the template
folder and copy the templates and assets from this project into it so the documentation generator can access them and they will have a standardized look.
Set up the server for your new files as follows:
config.edn
, configure pedestal to include a :file-path
like so::pedestal/service {:service-map #ig/ref :your-app.pedestal/service
:interceptors [whatever the interceptors already were if you've got 'em']
:dev? #duct/env "PEDESTAL_SERVICE_DEV"
:file-path "docs"}
Open the repl with clj -A:dev:gen-docs -e "(dev)(go)" -r
In the repl run:
(generate-docs)
If you have correctly formatted your :documentation
map, docs should be generated into your docs
folder!
If you have correctly set up your pedestal server, you should be able to see the docs at localhost:PORT/test-docs-name.html
!
- script:
name: generate docs
code: clojure -A:dev:gen-docs -e "(dev)(generate-docs)"
In your project.clj
, add hydrox to the [:profiles :dev :dependencies]
entry:
(defproject ...
...
:plugins ["lein-hydrox" "0.1.15"]
:profiles {:dev {:dependencies [...
[helpshift/hydrox "0.1.15"]
...]}}
...)
To initialise a project:
lein hydrox init
To generate documentation (watches project for changes and updates documentation accordingly):
lein hydrox
hydrox assists in the transmission of knowledge around a clojure project, providing in-repl management of documentation, docstrings and metadata through the reuse/repurposing of test code. The tool allows for a design-orientated workflow for the programming process, blurring the boundaries between design, development, testing and documentation.
Please see the docs for more information (generated using itself).
Copyright © 2015 Helpshift
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.
Can you improve this documentation? These fine people already did:
Chris Zheng & M LehrerEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close