nextjournal/clerk

Case where `clerk/row` displays only the first of its arguments

teodorlu opened this issue · 4 comments

Hi!

I have a document where

(clerk/row
 (scale ipe300 0.5)
 (scale hea300 0.5))

only displays the first value, (scale ipe300 0.5). I was expecting both values to be shown.

Full document: github / clerk garden. Document screenshot:

image

Simpler reproduction:

(clerk/row {:item 1} {:item 2})

Expected: both items are shown.
Actual: only last item is shown.

image

Fix: wrap both in a vector. Perhaps I should have been doing this all along?

image

Images produced with io.github.nextjournal/clerk {:mvn/version "0.15.957"}.

mk commented

@teodorlu thanks for the report & repro!

We also support passing a viewer opts map as the first argument and the heuristic to decide is overly simplistic (it interprets and map arg which isn't a wrapped-value as a viewer-opts arg). Besides the workaround to wrap it in a seq, another possibility is to wrap the first arg in :nextjournal/value key:

(clerk/row {:nextjournal/value (scale ipe300 0.5)}
           (scale hea300 0.5))

Right, makes sense. Thanks for explaining :nextjournal/value, TIL!

mk commented

@teodorlu the attached patch should fix the issue, thank you again!