Skip to content

Commit

Permalink
Fix code listings in result viewer and add example
Browse files Browse the repository at this point in the history
  • Loading branch information
philippamarkovics committed Feb 22, 2023
1 parent 92cfcc5 commit d4a43dd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions notebooks/viewers/markdown.clj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@ It's [Markdown](https://daringfireball.net/projects/markdown/), like you know it
;; >
;; > — Special Forms

;; ## Code Listings

;; ```
;; {:name :code,
;; :render-fn 'nextjournal.clerk.render/render-code,
;; :transform-fn
;; (comp
;; mark-presented
;; (update-val
;; (fn
;; [v]
;; (if (string? v) v (str/trim (with-out-str (pprint/pprint v)))))))}
;; ```

;; ## Sidenotes
;;
;; One of the most distinctive features of Tufte’s style is his _extensive use
Expand Down Expand Up @@ -73,6 +87,13 @@ It's [Markdown](https://daringfireball.net/projects/markdown/), like you know it
;; * Change name to Simon. Speak in thirs person.
;; * Major in philosophy. Ask people WHY they would like fries with that.

;; ## Code Listings As Markdown Result

^{::clerk/visibility {:code :hide}}
(clerk/md "```sh
clj -M:nextjournal/clerk nextjournal.clerk/serve! --watch-paths notebooks --browse
```")

(clerk/md "---")

;; ### Conclusion^[what usually average folks actually read.]
Expand Down
2 changes: 1 addition & 1 deletion src/nextjournal/clerk/render.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
[view-context/provide {:fetch-fn fetch-fn}
[:> ErrorBoundary {:hash hash}
[:div.relative
[:div.overflow-y-hidden
[:div
{:ref ref-fn}
[inspect-presented {:!expanded-at !expanded-at} @!desc]]]]])))

Expand Down

0 comments on commit d4a43dd

Please sign in to comment.