clerk

Jeremy 2025-01-07T10:38:55.188219Z

Is there a simpler way to switch to a different notebook from js/cljs? I'm using this:

(clerk/eval-cljs
 '(set! (.-show_notebook js/window)
        (fn [ns-str]
          (nextjournal.clerk.render/clerk-eval
           `(nextjournal.clerk/show! (find-ns (symbol ~ns-str)))))))
Also, clerk/html strips event handlers like :onclick; is it possible to turn off this behaviour? I'd like to add a simple on-click handler rather my move components to render-fn

Andrea 2025-01-10T12:36:54.336179Z

By using clerk/doc-url helper (or the sci context variants thereof) you should be able rely on our anchor handling. See e.g. https://github.com/nextjournal/clerk/blob/eaf545898067dcaa9a2d6b5f0d525969ff5daa57/notebooks/document_linking.clj. That should work both in local-serve as well as in a static app. If you want to handle anchor clicks to origin targets yourself, you can opt-out of clerk handling by adding :data-ignore-anchor-click attribute to your anchor element (see https://github.com/nextjournal/clerk/blob/b7207926bacb10e6af17075efd71df3363b74d21/src/nextjournal/clerk/builder_ui.clj#L307).

🙌 1
Jeremy 2025-01-10T12:42:30.040799Z

Thanks @andrea712

👍 1