This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-25
Channels
- # announcements (3)
- # asami (63)
- # babashka (5)
- # babashka-sci-dev (32)
- # beginners (56)
- # calva (2)
- # cider (28)
- # clj-commons (9)
- # clj-kondo (16)
- # cljdoc (41)
- # cljs-dev (19)
- # clojure (67)
- # clojure-europe (15)
- # clojure-nl (1)
- # clojure-poland (1)
- # clojure-uk (2)
- # clojurescript (27)
- # community-development (10)
- # data-science (2)
- # datascript (8)
- # datomic (21)
- # events (3)
- # fulcro (54)
- # graalvm (18)
- # introduce-yourself (2)
- # juxt (3)
- # lsp (6)
- # music (1)
- # nextjournal (8)
- # off-topic (44)
- # omni-trace (1)
- # reitit (13)
- # releases (3)
- # rewrite-clj (4)
- # shadow-cljs (10)
- # spacemacs (6)
- # sql (12)
- # tools-build (17)
- # tools-deps (3)
- # web-security (1)
Good morning! I have a question on clerk's viewers. I added:
(clerk/set-viewers! [{:pred #(instance? Path %)
:fetch-fn (fn [_ path] {:nextjournal/content-type "image/jpg"
:nextjournal/value (Files/readAllBytes path)})
:render-fn (fn [blob] (v/html [:img {:src (v/url-for blob)}]))}])
so that I can use:
(fs/path "./art/sketch-01-001-0001-0558.jpg")
to display an image. But I wonder, why can't I do something like
(clerk/table
`[[1 2] [3 ~(fs/path "./art/sketch-01-001-0001-0558.jpg")]])
to have an image in one of the cells of the table?hey @meditans, if you can use the git dep of Clerk this now comes with support for images, see https://github.com/nextjournal/clerk/blob/4862243b1d725a09c98ac08a7046a315e4b4c63e/notebooks/viewers/image.clj. There’s also some breaking changes of the viewer api, the render-fn now needs to be quoted to make it more explicit that it doens’t run on the JVM, see https://github.com/nextjournal/clerk/commit/e4acb372d33e0e66f38cafc140226ca89591114e. As to putting an image inside a table this is something I also want. I’ll try it later, it might require some small tweaks to support this.