Fork me on GitHub
Carsten Behring16:03:52

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
                                      (clerk/table {:head (ds/column-names %)
                                                    :rows (ds/rowvecs %)}))}])


the hash-map and nextjournal/value shouldn't be needed anymore

Carsten Behring21:03:21

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, 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.


^ 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