Skip to content

Commit ca9a489

Browse files
committed
Merge branch 'main' into taps-window-2
# Conflicts: # src/nextjournal/clerk/render.cljs # src/nextjournal/clerk/webserver.clj
2 parents 45aa8b5 + 82cc18f commit ca9a489

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+3539
-1246
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ jobs:
196196
run: echo $(yarn global dir)/node_modules
197197

198198
- name: 🧪 Build Rule 30 Notebook with SSR
199-
run: NODE_PATH=$(yarn global dir)/node_modules clojure -J-Dclojure.main.report=stdout -X:demo:nextjournal/clerk :git/sha '"${{ github.sha }}"' :git/url '"https://github.com/nextjournal/clerk"' :index '"notebooks/rule_30.clj"' :paths [] :ssr true :compile-css true
199+
run: NODE_PATH=$(yarn global dir)/node_modules clojure -J-Dclojure.main.report=stdout -X:demo:nextjournal/clerk :git/sha '"${{ github.sha }}"' :git/url '"https://github.com/nextjournal/clerk"' :index '"notebooks/rule_30.clj"' :paths [] :ssr true :compile-css true :exclude-js true
200200

201201
- name: 🔐 Google Auth
202202
uses: google-github-actions/auth@v0

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
.cpcache/
55
.lsp/
66
node_modules
7+
/scratch
78
notebooks/scratch*
89
/public/js/
910
/.shadow-cljs/
@@ -21,3 +22,4 @@ clerk.iml
2122
.clj-kondo/marick
2223
.clj-kondo/nextjournal/clerk
2324
.secrets.env
25+
report.html

CHANGELOG.md

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,105 @@
22

33
Changes can be:
44
* 🌟⭐️💫 features
5+
* 🚨 possibly breaking
56
* 🐞🐜 friendly or nasty bugs
67
* 🛠 dev improvements
78

89
## Unreleased
910

11+
* 👁️ Improve viewer customization
12+
13+
* Simplify customization of number of rows displayed for table viewer using viewer-opts, e.g. `(clerk/table {::clerk/page-size 7})`. Pass `{::clerk/page-size nil}` to display elisions. Can also be passed a form metadata. Fixes [#406](https://github.com/nextjournal/clerk/issues/406).
14+
15+
* Change semantics of `clerk/add-viewers!` to perform in-place positional replacement of named added viewers. Anonymous viewers (without a `:name`) or new named viewers will be prepended to the viewer stack. Assign a symbol `:name` to all of `clerk/default-viewers`.
16+
17+
* Support first-class `:add-viewers` attribute on viewer map which will do `clerk/add-viewers` before passing viewers down the tree. Use it in `table-viewer` and `markdown-viewer`. Both these viewers can now be customized more easily. For example, you can customize the `table-viewer` to show missing values differently, see [Book of Clerk](https://book.clerk.vision/#tables).
18+
19+
* 🚨 Rename `:nextjournal.clerk/opts` to `:nextjournal.clerk/render-opts` to clarify this options map is available as the second arg to parametrize the `:render-fn`. Still support the `:nextjournal.clerk/opts` for now.
20+
21+
* 📖 Improve Table of Contents design and fixing re-rendering issues. Also added suport for chapter expansion.
22+
23+
* 📒 Mention Tap Inspector in Book of Clerk & on Homepage
24+
25+
* 🛠 Upgrade `framer-motion` dep to `10.12.16`.
26+
27+
* 💫 Assign `:name` to every viewer in `default-viewers`
28+
29+
* 🐞 Don't run existing files through `fs/glob`, fixes [#504](https://github.com/nextjournal/clerk/issues/504). Also improves performance of homepage.
30+
31+
* 🐞 Show correct non-var return value for deflike form, fixes [#499](https://github.com/nextjournal/clerk/issues/499)
32+
33+
## 0.14.919 (2023-06-13)
34+
35+
* 🚨 Breaking Changes:
36+
37+
* Change `nextjournal.clerk.render/clerk-eval` to not recompute the currently shown document when using the 1-arity version. Added a second arity that takes an opts map with a `:recompute?` key.
38+
39+
* Change `nextjournal.clerk/eval-cljs` to only take one form (like `clojure.core/eval`) but support viewer opts. If you want multiple forms to be evaluated, wrap them in a `do`.
40+
41+
1042
* 💈 Show execution progress
1143

1244
To see what's going on while waiting for a long-running computation, Clerk will now show an execution status bar on the top. For named cells (defining a var) it will show the name of the var, for anonymous expressions, a preview of the form.
1345

14-
* 🍕 `clerk/fragment` for splicing a seq of values into the document as if it were produced by results of individual cells. Useful when programmatically generating content.
46+
* 🔗 Interactive Links, Index and Homepage
47+
48+
Links can now be followed in interactive mode and the index can be viewed. Previously this could only be seen after a `build!`. Add support evaluating a given doc by entering it in the browser's address bar.
49+
50+
Use these features to build a new welcome page that gives more useful information, including links to potential notebooks in the project.
51+
52+
* ⚡️ Speed up analysis of gitlibs using git sha, resolve protocol methods
53+
54+
This significantly speeds up analysis for gitlibs by using the git sha as a hash (thus treating them as immutable) instead of handling them on a per-form level.
55+
56+
Also resolve protocol methods to the defining protocol, which would previously not be detected.
57+
58+
Lastly drop the location cache which is no longer needed.
59+
60+
* 🍕 Add `clerk/fragment` for splicing a seq of values into the document as if it were produced by results of individual cells. Useful when programmatically generating content.
61+
62+
* 🚰 Improve Tap Inspector
63+
64+
* Support customizing of `:nextjournal.clerk/width` and `:nextjournal.clerk/budget` for individual tapped values
65+
* Fix re-rendering of tapped values by assigning stable react keys
66+
* Build it on top of `clerk/fragment`
67+
68+
* 🍒 Add support for cherry as an alternative to sci to evaluate `:render-fn`s. You can change it per form (using form metadata or viewer opts) or doc-wide (using ns metadata) with `{:nextjournal.clerk/render-evaluator :cherry}`.
69+
70+
* 🏳️‍🌈 Syntax highlighting for code listings in all [languages supported by codemirror](https://github.com/codemirror/language-data) ([#500](https://github.com/nextjournal/clerk/issues/500)).
71+
72+
* ⭐️ Adds support for customization of viewer options
73+
74+
Support both globally (via ns metadata or a settings marker) or locally (via form metadata or the viewer options map).
75+
76+
Supported options are:
77+
* `:nextjournal.clerk/auto-expand-results?`
78+
* `:nextjournal.clerk/budget`
79+
* `:nextjournal.clerk/css-class`
80+
* `:nextjournal.clerk/visibility`
81+
* `:nextjournal.clerk/width`
82+
* `:nextjournal.clerk/render-evaluator`
1583

1684
* 🔌 Make websocket reconnect automatically on close to avoid having to reload the page
85+
1786
* 💫 Cache expressions that return `nil` in memory
1887

88+
* 💫 Support non-evaluated clojure code listings in markdown documents by specifying `{:nextjournal.clerk/code-listing true}` after the language ([#482](https://github.com/nextjournal/clerk/issues/482)).
89+
90+
* 💫 Support imported vars (e.g. by potemkin) in location analysis
91+
92+
By considering `:file` on var meta in location analysis. Previously we would not find a location for vars where the namespace did not match the source file. As we're not caching negative findings this can speed up analysis for deps with a large number of imported vars significantly.
93+
94+
* 💫 Support serializing `#inst` and `#uuid` to render-fns
95+
96+
* 🐜 Turn off analyzer pass for validation of `:type` tags, fixes [#488](https://github.com/nextjournal/clerk/issues/488) @craig-latacora
97+
98+
* 🐜 Strip `:type` metadata from forms before printing them to hash, fixes [#489](https://github.com/nextjournal/clerk/issues/489) @craig-latacora
99+
100+
* 🐜 Ensure custom `print-method` supporting unreadable symbols preserves metadata
101+
102+
* 🐞 Preserve `*ns*` during `build!`, fixes [#506](https://github.com/nextjournal/clerk/issues/506)
103+
19104
## 0.13.842 (2023-03-07)
20105

21106
* 💫 Support pagination for values nested inside `clerk/html`

README.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Clerk comes with a [demo repo](https://github.com/nextjournal/clerk-demo/) full
2121

2222
## ⚖️ Rationale
2323

24-
Computational notebooks allow arguing from evidence by mixing prose with executable code. For a good overview of problems users encounter in traditional notebooks like Jupyter, see [I don't like notebooks](https://www.youtube.com/watch?v=7jiPeIFXb6U) and [What’s Wrong with Computational Notebooks? Pain Points, Needs, and Design Opportunities](https://web.eecs.utk.edu/\~azh/pubs/Chattopadhyay2020CHI_NotebookPainpoints.pdf).
24+
Computational notebooks allow arguing from evidence by mixing prose with executable code. For a good overview of problems users encounter in traditional notebooks like Jupyter, see [I don't like notebooks](https://www.youtube.com/watch?v=7jiPeIFXb6U) and [What’s Wrong with Computational Notebooks? Pain Points, Needs, and Design Opportunities](https://www.microsoft.com/en-us/research/uploads/prod/2020/03/chi20c-sub8173-cam-i16.pdf).
2525

2626
Specifically Clerk wants to address the following problems:
2727

@@ -42,19 +42,20 @@ ALPHA, expect breaking changes.
4242

4343
## 👩‍🎨 Using Clerk
4444

45-
To use Clerk in your project, add the following dependency to your `deps.edn`:
45+
To use Clerk in your project, you'll need Java 11+ and [`clojure`](https://clojure.org/guides/install_clojure). Add the
46+
following dependency to your `deps.edn`:
4647

4748
```edn
48-
{:deps {io.github.nextjournal/clerk {:mvn/version "0.13.842"}}}
49+
{:deps {io.github.nextjournal/clerk {:mvn/version "0.14.919"}}}
4950
```
5051

5152
Require and start Clerk as part of your system start, e.g. in `user.clj`:
5253

53-
```clojure
54+
```clojure {:nextjournal.clerk/code-listing true}
5455
(require '[nextjournal.clerk :as clerk])
5556

5657
;; start Clerk's built-in webserver on the default port 7777, opening the browser when done
57-
(clerk/serve! {:browse? true})
58+
(clerk/serve! {:browse true})
5859

5960
;; either call `clerk/show!` explicitly
6061
(clerk/show! "notebooks/rule_30.clj")
@@ -68,7 +69,6 @@ Require and start Clerk as part of your system start, e.g. in `user.clj`:
6869
;; Build a html file from the given notebook notebooks.
6970
;; See the docstring for more options.
7071
(clerk/build! {:paths ["notebooks/rule_30.clj"]})
71-
7272
```
7373

7474
You can then access Clerk at <http://localhost:7777>.
@@ -109,7 +109,7 @@ In IntelliJ/Cursive, you can [set up REPL commands](https://cursive-ide.com/user
109109

110110
With [neovim](https://neovim.io/) + [conjure](https://github.com/Olical/conjure/) one can use the following vimscript function to save the file and show it with Clerk:
111111

112-
```
112+
```vimscript
113113
function! ClerkShow()
114114
exe "w"
115115
exe "ConjureEval (nextjournal.clerk/show! \"" . expand("%:p") . "\")"
@@ -122,15 +122,15 @@ nmap <silent> <localleader>cs :execute ClerkShow()<CR>
122122
Make sure you have [Babashka installed](https://github.com/babashka/babashka#installation), and run:
123123

124124
```bash
125-
bb dev :browse\? true
125+
bb dev :browse true
126126
```
127127

128128
The will start everything needed to develop Clerk and open your
129129
default browser. You can connect your favorite editor to it using nREPL.
130130

131131
Any trailing arguments to `bb dev` will be forwarded to `clojure -X`
132132
and `clerk/serve!`. So if you prefer to not open your browser, leave
133-
out the `:browse\? true` arguments.
133+
out the `:browse true` arguments.
134134

135135
## 🐞 Known Issues
136136

@@ -141,7 +141,7 @@ See [notebooks/onwards.md](https://github.com/nextjournal/clerk/blob/main/notebo
141141
If you are a researcher and use Clerk in your work, we encourage you to cite our work.
142142
You can use the following BibTeX citation:
143143

144-
```
144+
```bibtex
145145
@misc{clerk-github,
146146
author = {Martin Kavalar and
147147
Jack Rusher},
@@ -151,4 +151,3 @@ You can use the following BibTeX citation:
151151
year = 2023
152152
}
153153
```
154-

bb.edn

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
build:static-app {:doc "Builds a static app with default notebooks"
3232
:task (apply clojure "-X:demo:nextjournal/clerk" *command-line-args*)}
3333

34+
build:static-app-test-release
35+
{:doc "Builds static app which uses output of build:js.
36+
Run with additional --paths notebooks/cherry.clj to test single notebook."
37+
:task (apply clojure "-M:demo:nextjournal/clerk:test-release-js" *command-line-args*)}
38+
3439
-check {:depends [lint test:clj]}
3540

3641
check {:doc "Check to run before pushing"

bb/tasks.clj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@
4040
(str "{io.github.nextjournal/clerk {:mvn/version " (pr-str (shared/version)) "}}"))
4141
(spit "README.md")))
4242

43+
(defn update-book []
44+
(->> (str/replace (slurp "book.clj")
45+
(re-pattern "\\{io.github.nextjournal/clerk \\{:mvn/version \".+\"\\}\\}")
46+
(str "{io.github.nextjournal/clerk {:mvn/version " (pr-str (shared/version)) "}}"))
47+
(spit "book.clj")))
48+
4349
(defn tag []
4450
(let [tag (str "v" (shared/version))]
4551
(shell "git tag" tag)))
@@ -48,6 +54,7 @@
4854
(update-meta)
4955
(update-changelog)
5056
(update-readme)
57+
(update-book)
5158
(shell "git add"
5259
"resources/META-INF"
5360
"README.md"

0 commit comments

Comments
 (0)