This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-01
Channels
- # announcements (2)
- # architecture (8)
- # babashka (21)
- # beginners (75)
- # calva (3)
- # clj-kondo (6)
- # cljdoc (6)
- # cljs-dev (10)
- # clojars (4)
- # clojure (94)
- # clojure-europe (12)
- # clojure-nl (4)
- # clojure-norway (3)
- # clojure-spec (6)
- # clojure-uk (4)
- # clojurescript (51)
- # community-development (13)
- # core-async (3)
- # css (1)
- # cursive (8)
- # datomic (7)
- # girouette (3)
- # graphql (3)
- # improve-getting-started (4)
- # integrant (2)
- # interop (5)
- # jobs (12)
- # kaocha (1)
- # lsp (24)
- # malli (4)
- # membrane (13)
- # nextjournal (9)
- # off-topic (6)
- # re-frame (9)
- # reitit (2)
- # remote-jobs (1)
- # reveal (4)
- # ring (4)
- # scittle (3)
- # shadow-cljs (4)
- # spacemacs (1)
- # testing (2)
- # vrac (1)
It seems that in latest Clerk commit (b6f47cf80c49b87d3765d355c61dae173cb9c2c6), the custom viewer for dataset does not work any more. I use the same code as before:
(clerk/set-viewers! [{:pred tc/dataset?
:transform-fn #(hash-map
:nextjournal/value
(clerk/table {:head (ds/column-names %)
:rows (ds/rowvecs %)}))}])
I have an other strange case by using the above simplified custom viewer. It works for a single dataset object, but for a sequence of them it shows only a lot of white space:
can I define a var in the sci
runtime for a notebook? I'd like to be able to replicate the https://github.com/nextjournal/clerk/blob/main/notebooks/interactivity.clj, but without having to hook into the clerk runtime to fetch the values. If I could pass vars through to sci
at compile time, then I could build out more interactivity for notebooks that I export from clerk
to static HTML, which would be very nice.
According to the changelog, I see that the sci
namespace is wrapped in an atom, but I don't see how to do so or where in the clerk
namespaces this atom is defined. An example of modifying the sci
namespace using this atom would be helpful.
https://github.com/nextjournal/clerk/blob/main/CHANGELOG.md#04305-2021-12-13
Aha, I think I found what I'm looking for: https://github.com/nextjournal/clerk/blob/8c75ae84d52e9e60d09179678a3c4411203164b9/src/nextjournal/clerk/sci_viewer.cljs#L983-L984
^ never mind, I forgot that was a cljs and not a clj namespace, so it's inaccessible from the clj environment.
I did come up with a hacky workaround in the meantime by sneaking a def
into :render-fn
:
yeah, that works. There’s also with-viewer
btw where you don’t need to specify a :pred
. Overriding / extending the !sci-ctx
atom is meant for when you’re opting into doing your own ClojureScript compilation and goes together with overriding !resource->url
https://github.com/nextjournal/clerk/blob/8026e1edcf119c336d015f8905451586a36c4dea/src/nextjournal/clerk/config.clj#L20
Aha, I think I found what I'm looking for: https://github.com/nextjournal/clerk/blob/8c75ae84d52e9e60d09179678a3c4411203164b9/src/nextjournal/clerk/sci_viewer.cljs#L983-L984
^ never mind, I forgot that was a cljs and not a clj namespace, so it's inaccessible from the clj environment.
I did come up with a hacky workaround in the meantime by sneaking a def
into :render-fn
:
yeah, that works. There’s also with-viewer
btw where you don’t need to specify a :pred
. Overriding / extending the !sci-ctx
atom is meant for when you’re opting into doing your own ClojureScript compilation and goes together with overriding !resource->url
https://github.com/nextjournal/clerk/blob/8026e1edcf119c336d015f8905451586a36c4dea/src/nextjournal/clerk/config.clj#L20