Liking cljdoc? Tell your friends :D

clerk-utils

Build Status License cljdoc badge Clojars Project

A small collection of functions and macros that have come in handy while documenting libraries with Nextjournal's Clerk.

Quickstart

Install clerk-utils into your Clojure project using the instructions at its Clojars page:

Clojars Project

Require mentat.clerk-utils in your namespace:

(ns my-app
   (:require [mentat.clerk-utils :as u]
             [nextjournal.clerk :as-alias clerk]))

Use ->clerk and ->clerk-only to include forms that will only evaluate if Clerk is available, but will act as comment otherwise:

(u/->clerk
  (defn exclaim [s] (str s "!"))

  [:pre (exclaim "I won't run if Clerk is missing")])

cljs allows you to push Reagent forms directly into the client without building out a Clerk viewer:

(u/cljs
 (let [text "Include any Reagent vector!"]
   [:pre text]))
image

See the project's interactive documentation notebook for more guides and examples.

Who is using clerk-utils?

The following documentation notebooks include examples of the cljs macro:

Interactive Documentation via Clerk

The project's interactive documentation was generated using Nextjournal's Clerk. If you'd like to edit or play with the documentation, you'll need to install

Once this is done, run this command in one terminal window to build and serve the custom JS required by the notebook:

bb dev-notebook

In another terminal window, run

bb start-clerk

This should open a browser window to http://localhost:7777 with the contents of the documentation notebook. Any edits you make to dev/jsxgraph/notebook.clj will be picked up and displayed in the browser on save.

Thanks and Support

To support this work and my other open source projects, consider sponsoring me via my GitHub Sponsors page. Thank you to my current sponsors!

I'm grateful to Clojurists Together for financial support during this library's creation. Please consider becoming a member to support this work and projects like it.

License

Copyright © 2022 Sam Ritchie.

Distributed under the MIT License. See LICENSE.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close