Skip to content

Commit

Permalink
Pass at docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zampino committed Aug 29, 2023
1 parent cadd27d commit 524721e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/nextjournal/clerk.clj
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,16 @@
([viewer-opts x] (v/html viewer-opts x)))

(defn md
"Displays `x` with the markdown viewer.
"Displays `x` with the markdown viewer. Accepts strings or a structure as returned by [[nextjournal.markdown/parse]].
Supports an optional first `viewer-opts` map arg with the following optional keys:
* `:nextjournal.clerk/width`: set the width to `:full`, `:wide`, `:prose`
* `:nextjournal.clerk/viewers`: a seq of viewers to use for presentation of this value and its children
* `:nextjournal.clerk/render-opts`: a map argument that will be passed as a secong arg to the viewers `:render-fn`"
* `:nextjournal.clerk/render-opts`: a map argument that will be passed as a secong arg to the viewers `:render-fn`.
See also [[nextjournal.clerk.viewer/markdown-viewer]]."

([x] (v/md x))
([viewer-opts x] (v/md viewer-opts x)))

Expand Down Expand Up @@ -553,7 +556,7 @@
#_(with-cache (do (Thread/sleep 4200) 42))

(defmacro defcached
"Like `clojure.core/def` but with Clerk's caching of the value."
"Like `clojure.core/def` but with Clerk's caching of the value. See also [[with-cache]]."
[name expr]
`(let [result# (-> ~(v/->edn expr) eval/eval-string :blob->result first val :nextjournal/value)]
(def ~name result#)))
Expand Down
5 changes: 4 additions & 1 deletion src/nextjournal/clerk/viewer.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,9 @@
%)
presented-result)))

(defn get-default-viewers []
(defn get-default-viewers
"Returns viewers from the global scope when set, defaults to [[default-viewers]] (see also [[!viewers]])."
[]
(:default @!viewers default-viewers))

(defn datafy-scope [scope]
Expand Down Expand Up @@ -982,6 +984,7 @@
{:name `vega-lite-viewer :render-fn 'nextjournal.clerk.render/render-vega-lite :transform-fn mark-presented})

(def markdown-viewer
"A clerk viewer for rendering markdown. See also [[nextjournal.clerk/md]]."
{:name `markdown-viewer
:add-viewers markdown-viewers
:transform-fn (fn [wrapped-value]
Expand Down

0 comments on commit 524721e

Please sign in to comment.