-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normalize viewers to support full map form (#77)
For the functional (clerk/with-viewer and clerk/with-viewers) and metadata api (^{::clerk/viewer ,,,} and ^{::clerk/viewers ,,,}). Also update sample notebooks accordingly.
- Loading branch information
Showing
11 changed files
with
188 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
^{:nextjournal.clerk/visibility :hide} | ||
(ns viewer-normalization | ||
(:require [nextjournal.clerk :as clerk])) | ||
|
||
(clerk/with-viewer '(fn [v] (v/html [:span "The answer is " v "."])) | ||
42) | ||
|
||
^{::clerk/viewer '#(v/html [:span "The answer is " % "."])} | ||
(do 42) | ||
|
||
^{::clerk/viewer {:render-fn '(fn [v] (v/html [:span "The answer is " v "."]))}} | ||
(do 42) | ||
|
||
|
||
(clerk/with-viewer {:render-fn '(fn [v] (v/html [:span "The answer is " v "."]))} | ||
42) | ||
|
||
(clerk/with-viewer {:render-fn '(fn [v] (v/html [:span "The answer is " v "."])) :transform-fn inc} | ||
41) | ||
|
||
^{::clerk/viewer {:render-fn '#(v/html [:span "The answer is " % "."]) :transform-fn inc}} | ||
(do 41) | ||
|
||
(clerk/with-viewers [{:pred (constantly true) :render-fn '(fn [v] (v/html [:span "The answer is " v "."])) :transform-fn inc}] | ||
41) | ||
|
||
^{::clerk/viewer {:render-fn '#(v/html [:span "The answer is " % "."]) :transform-fn inc}} | ||
(do 41) | ||
|
||
|
||
^{::clerk/viewers [{:pred (constantly true) :render-fn '(fn [v] (v/html [:span "The answer is " v "."])) :transform-fn inc}]} | ||
(do 41) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.