Fork me on GitHub
#clerk
<
2023-10-02
>
otfrom13:10:05

Is there a way to toggle whether or not comments show up as text in a notebook? I do a fair amount of setting things up at the top of the notebook that will eventually be factored out, but I'd like to be able to add comments w/o seeing it in the notebook

mkvlr13:10:06

not yet, been thinking about a :prose visibility setting

👍 1
mkvlr13:10:33

for now you can wrap the comments e.g. in

(
;; my comments
)

otfrom13:10:11

thx! that's what I've been doing. Just a bit clunky. Just didn't want to miss something obvious

👍 2
respatialized20:10:16

Is there a version of clerk/example that doesn't show the source code of the form it displays (just the results)?

respatialized16:10:47

Using (when nextjournal.clerk.config/*in-clerk* ...) is enough for now, but if I have a namespace that doesn't have a dependency on Clerk this will throw an unresolved symbol error, right?

jackrusher16:10:56

if you want to go that route, you can add a resolve / ns-resolve check to your when to avoid trying to check the symbol if it isn’t defined

1
1
mkvlr16:10:25

I have this, I’ll paste my version later / tomorrow

mkvlr08:10:42

@UFTRLDZEW here’s what I have on this other project:

(defmacro clerk-comment
  "Evaluates the expressions in `body` showing code next to results in Clerk.

  Does nothing outside of Clerk, like `clojure.core/comment`."
  [& body]
  (when nextjournal.clerk.config/*in-clerk*
    `(nextjournal.clerk/fragment ~(vec body))))

(intern 'nextjournal.clerk (with-meta 'comment (meta #'clerk-comment)) @#'clerk-comment)

mkvlr08:10:10

let me know if this is helpful, considering to include it in clerk

respatialized16:10:47

Using (when nextjournal.clerk.config/*in-clerk* ...) is enough for now, but if I have a namespace that doesn't have a dependency on Clerk this will throw an unresolved symbol error, right?