nextjournal

genmeblog 2022-02-21T15:38:19.382149Z

[showing off] (Almost) full documentation of my clojure2d.color namespace done in Clerk. Very nice experience: https://clojure2d.github.io/clojure2d/docs/notebooks/index.html#/notebooks/color.clj

5
genmeblog 2022-02-21T15:45:43.667779Z

Still TODO: correct writing, I'm really bad at this 😕; TOC (pending on Clerk site); tidy up tables

genmeblog 2022-02-21T15:47:59.620919Z

it might be my poor styling, but how to control width of table columns?

genmeblog 2022-02-21T16:02:58.000269Z

The other issue I see in rendered static:

genmeblog 2022-02-21T16:03:22.019289Z

(document uses caching)

genmeblog 2022-02-21T16:10:38.128349Z

And it's really strange: sometimes I have double scrollbar in browser (Edge)

genmeblog 2022-02-21T16:10:40.657969Z

2022-02-21T21:16:38.957109Z

Just made an issue for the "class" problem: https://github.com/nextjournal/clerk/issues/95

2022-02-21T15:56:12.110219Z

Is it possible to get a vega-lite plot using clerk/vl and have it rendered as SVG (instead of PNG) ?

2022-02-21T15:58:38.749069Z

Zooming into the plots does not look nice :

2022-02-21T16:08:00.284919Z

The rendere seems to support it. Do we have away to configure it ?

mkvlr 2022-02-21T16:24:52.178229Z

not currently

mkvlr 2022-02-21T16:27:06.791739Z

you can override the default vega viewer along the lines of https://github.com/nextjournal/clerk/pull/86

2022-02-21T18:23:03.708959Z

I feel so useless in Clojurescript, but maybe some motivation to learn a bit. I came so far, copy from teh exiting VL viewer

(def my-vega {:pred string?
              :fetch-fn (fn [_ x] x)
              :render-fn '(fn [value]
                            (v/html
                             (when value

                               [v/with-d3-require {:package ["vega-embed@6.11.1"]}
                                (require '[applied-science.js-interop :as j])
                                (j/fn [^:js {:keys [embed]}]
                                  [:div {:style {:overflow-x "auto"}}
                                   [:div.vega-lite {:ref #(when % (embed % (clj->js value)))}]])])))})
But then it gave me below exception and I have no clue about it. The require statement seems to have passed, but then ???
Error: Could not resolve symbol: j/fn
    at new hq ()
    at Function.iq.j ()
    at Function.iq.h ()
    at W6 ()
    at Y7 ()
    at a8 ()
    at oBa ()
    at t8 ()
    at e8 ()
    at 

2022-02-21T20:21:57.839229Z

I give up at this point. My ClojureScript knowledge is too rudimentary to translate the "javascript" documentation of Vega on how set the "renderer" to "svg" into the viewer API of Clerk. It is clear, that adding own custom viewers to Clerk, requires very specific knowledge. But I do hope, that a re-usable library of those can be developed over time and simply be used.

2022-02-21T20:23:42.317229Z

But I just discovered that the vega embed options can be added to the vega spec itself:+1: So we can render as svg by adding this to the spec:

:usermeta {:embedOptions {:renderer "svg"}}

💯 6
1
😮 1