clerk

2023-10-02T13:45:05.776049Z

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

mkvlr 2023-10-02T13:49:06.649019Z

not yet, been thinking about a :prose visibility setting

๐Ÿ‘ 1
mkvlr 2023-10-02T13:49:33.662589Z

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

(
;; my comments
)

2023-10-02T13:50:11.872669Z

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

๐Ÿ‘ 2
respatialized 2023-10-02T20:12:16.436459Z

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

respatialized 2023-10-03T16:33:47.419649Z

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?

2023-10-03T16:38:56.581649Z

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
mkvlr 2023-10-03T16:55:25.469219Z

I have this, Iโ€™ll paste my version later / tomorrow

mkvlr 2023-10-05T08:24:42.589659Z

@afoltzm 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)

mkvlr 2023-10-05T08:25:10.559989Z

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