diff --git a/CHANGELOG.md b/CHANGELOG.md index d040635c5..0a8ca9b71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,8 @@ Changes can be: ## Unreleased -... +* 💫 Allow to disable welcome page in `serve!` +* 🐞 Fix `row` and `col` viewers not showing a first map argument, fixes [#567](https://github.com/nextjournal/clerk/issues/567) @teodorlu ## 0.15.957 (2023-09-28) diff --git a/src/nextjournal/clerk/viewer.cljc b/src/nextjournal/clerk/viewer.cljc index d673922d3..88ee5e0f3 100644 --- a/src/nextjournal/clerk/viewer.cljc +++ b/src/nextjournal/clerk/viewer.cljc @@ -213,7 +213,9 @@ (defn with-viewer-extracting-opts [viewer & opts+items] ;; TODO: maybe support sequantial & viewer-opts? (cond - (and (map? (first opts+items)) (not (wrapped-value? (first opts+items)))) + (and (map? (first opts+items)) + (not (wrapped-value? (first opts+items))) + (seq (set/intersection parser/block-settings (set (keys (first opts+items))) ))) (with-viewer viewer (first opts+items) (rest opts+items)) (and (sequential? (first opts+items)) (= 1 (count opts+items))) diff --git a/test/nextjournal/clerk/viewer_test.clj b/test/nextjournal/clerk/viewer_test.clj index ca9cea512..f13f079e1 100644 --- a/test/nextjournal/clerk/viewer_test.clj +++ b/test/nextjournal/clerk/viewer_test.clj @@ -398,3 +398,12 @@ (-> (eval/eval-string "(ns test.removed-metadata\n(:require [nextjournal.clerk :as c]))\n\n^::c/no-cache (do 'this)") view/doc->viewer v/->value :blocks second v/->value)))) + +(deftest col-viewer-map-args + (testing "extracts first arg as viewer-opts" + (is (= [{:foo :bar}] + (v/->value (v/col {:nextjournal.clerk/width :wide} {:foo :bar}))))) + + (testing "doesn't treat plain map as viewer-opts" + (is (= [{:foo :bar} {:bar :baz}] + (v/->value (v/col {:foo :bar} {:bar :baz}))))))