This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-17
Channels
- # ai (1)
- # announcements (1)
- # aws (38)
- # babashka (25)
- # beginners (84)
- # biff (11)
- # calva (58)
- # clerk (14)
- # clj-kondo (14)
- # cljdoc (9)
- # cljs-dev (2)
- # clojars (2)
- # clojure (93)
- # clojure-czech (2)
- # clojure-dev (13)
- # clojure-europe (19)
- # clojure-nl (1)
- # clojure-spec (13)
- # clojure-uk (2)
- # clojurescript (6)
- # conjure (1)
- # core-async (9)
- # cursive (12)
- # data-science (7)
- # datahike (47)
- # datalevin (10)
- # datalog (3)
- # datomic (35)
- # emacs (3)
- # events (4)
- # fulcro (49)
- # gratitude (7)
- # humbleui (1)
- # hyperfiddle (42)
- # jobs-discuss (19)
- # kaocha (5)
- # lsp (20)
- # malli (3)
- # meander (2)
- # membrane (2)
- # off-topic (22)
- # pathom (2)
- # polylith (14)
- # practicalli (1)
- # rdf (3)
- # reitit (2)
- # shadow-cljs (11)
- # squint (3)
- # tools-deps (32)
- # vim (9)
- # xtdb (16)
I appear to be getting https://clojurians.slack.com/archives/C035GRLJEP8/p1680645356357219 with images not rendering in clerk. I can reproduce it with the minimal example from there too. But also this appears to occur whether I have enabled slideshow viewers or not. :thinking_face: Any ideas?
> But also this appears to occur whether I have enabled slideshow viewers or not. Which version of Clerk is that happening to? As of the latest git SHA images seem to be working as per https://snapshots.nextjournal.com/clerk/build/5e875e256a28a6deabf27bd6fc20f44cee5dad20/index.html#/notebooks/viewers/image.clj. Also tried the mentioned minimal repro locally and cannot reproduce.
I appear to see the issue with both:
io.github.nextjournal/clerk {:git/sha "5e875e256a28a6deabf27bd6fc20f44cee5dad20"}
io.github.nextjournal/clerk {:mvn/version "0.13.842"}
when running with io.github.nextjournal/clerk-slideshow {:git/sha "977003e581d78f4f554bb8ae73f877f4070925c3"}
hmm, not really able to reproduce at those deps coordinates with
(ns example-talk
#:nextjournal.clerk{:visibility {:code :hide}}
(:require
[ :as io]
[nextjournal.clerk :as clerk]
[nextjournal.clerk-slideshow :as slideshow])
(:import
(javax.imageio ImageIO)))
;; ---
;; # Testing
^{::clerk/visibility {:result :hide}}
(comment
(clerk/add-viewers! [slideshow/viewer])
(clerk/reset-viewers! clerk/default-viewers))
(ImageIO/read (io/file "test-image.png"))
works just fine for me locally. If you inspect the notebook in the browser and follow the img src, are you getting a 404 at the URL and what kind of URL are you getting? Assuming you’re trying in interactive mode (localhost:<port>)The URL to the img
looks like this: /_blob/5dsCzXQxZ5s8WwXqUeEKTRsdY21uxe?path=[]
and yes it’s in interactive mode localhost:7777
is there a nice way to have dependant blocks, so pull data in a block then generate a table and graph, If i put the data into a def it does not trigger an update, is there something built in for this ?
If you change a def
, it will trigger re-computation on dependent forms. I think maybe you mean that you want Clerk to watch an external file for changes to the content in that file?
apologies you are quite right must have been something else causing my behaviour, thanks for clarifying 🙂
Clark analyzer seems a bit more sensitive than the clojure compiler. Code which tags values with unknown classes in a body of a form will compile file, and run fine. However, the clerk analyzer will error out:
(require '[nextjournal.clerk :as clerk])
;; this is a brute way to make the clerk analyzer resilient in the case of
;; an unknown class tag
;;
;; (alter-var-root #'nextjournal.clerk.analyzer/analyzer-passes-opts
;; (fn [v]
;; (assoc v
;; :validate/wrong-tag-handler (fn [tag node]
;; nil))))
;; This will compile and run just fine, but clerk errors when evaluating this as
;; a notebook.
(defmulti foo :tag)
(defmethod foo :baz [v] (pr ^Something v))
(foo {:tag :baz})
See the commented out form that sets the :validate/wrong-tag-handler to make it just returna. nil alue instead of throwing an exception. I discovered this when trying to use clerk in a namespace that uses malli. the print-method's defined in malli use shorthand tags for the IntoSchema and Schema protocols, that break clerk.