Show utilities for Clerk.
Show utilities for Clerk.
(show-cljs)
(show-cljs & exprs)
CLJC macro that allows you to define forms in ClojureScript and make them available to Clerk's browser in a single place.
Returns a form that executes all exprs
and renders the final form.
If the final form evaluates to a vector, the vector is interpreted as a
Reagent component. (To present a vector, prepend the form with ^:inspect
metadata.)
Else, the form is presented with [nextjournal.clerk.viewer/inspect form]
.
NOTE that this macro only makes sense when used inside of a cljc file, not in clj or cljs independently!
When called from ClojureScript, emits all top-level defn
forms and returns a
thunk that executes all non-defn
forms when called. As a side effect, this
thunk is stored under show_cljs.<hash-derived-name>
in js/window
.
When called from Clojure, generates the same <hash-derived-name>
from the
code forms and calls [[loading-viewer]] with this name.
CLJC macro that allows you to define forms in ClojureScript and make them available to Clerk's browser in a single place. Returns a form that executes all `exprs` and renders the final form. If the final form evaluates to a vector, the vector is interpreted as a Reagent component. (To present a vector, prepend the form with `^:inspect` metadata.) Else, the form is presented with `[nextjournal.clerk.viewer/inspect form]`. ## How it Works NOTE that this macro only makes sense when used inside of a cljc file, not in clj or cljs independently! When called from ClojureScript, emits all top-level `defn` forms and returns a thunk that executes all non-`defn` forms when called. As a side effect, this thunk is stored under `show_cljs.<hash-derived-name>` in `js/window`. When called from Clojure, generates the same `<hash-derived-name>` from the code forms and calls [[loading-viewer]] with this name.
(show-sci & exprs)
Returns a form that executes all exprs
in Clerk's SCI environment and renders
the final form. If the final form evaluates to a vector, the vector is
interpreted as a Reagent component.
Else, the form is presented with [nextjournal.clerk.viewer/inspect form]
. (To present a vector, manually wrap the final form in
[nextjournal.clerk.viewer/inspect ,,,]
.)
Works in both clj
and cljs
contexts; in cljs
this is equivalent to
clojure.core/comment
.
Returns a form that executes all `exprs` in Clerk's SCI environment and renders the final form. If the final form evaluates to a vector, the vector is interpreted as a Reagent component. Else, the form is presented with `[nextjournal.clerk.viewer/inspect form]`. (To present a vector, manually wrap the final form in `[nextjournal.clerk.viewer/inspect ,,,]`.) Works in both `clj` and `cljs` contexts; in `cljs` this is equivalent to `clojure.core/comment`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close