Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion notebooks/cards.clj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

;; ## Images
(c/card
(v/image "https://images.freeimages.com/images/large-previews/773/koldalen-4-1384902.jpg"))
(v/image "https://images.unsplash.com/photo-1532879311112-62b7188d28ce?w=1200&h=800&fit=crop"))

;; ## $\LaTeX$
(c/card
Expand Down
4 changes: 2 additions & 2 deletions notebooks/viewers/image.clj
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
;; For convenience, you can use the `clerk/image` function to create a buffered image from a string or anything `java.awt.image.BufferedImage/read` takes. You can also use `clerk/figure` to show the image with a descriptive caption below it.

;; A large image with an aspect ratio smaller 2 is shown wider.
(clerk/image "https://images.freeimages.com/images/large-previews/773/koldalen-4-1384902.jpg")
(clerk/image "https://images.unsplash.com/photo-1532879311112-62b7188d28ce?w=1200&h=800&fit=crop")

;; Smaller images are centered and shown using their intrinsic dimensions. Here, we're using `clerk/figure`:
(clerk/image "https://nextjournal.com/data/QmeyvaR3Q5XSwe14ZS6D5WBQGg1zaBaeG3SeyyuUURE2pq?filename=thermos.gif&content-type=image/gif")

;; Layout options are also available. For example, `{::clerk/width :full}` renders the image in full width.
(clerk/image {::clerk/width :full} "https://images.freeimages.com/images/large-previews/773/koldalen-4-1384902.jpg")
(clerk/image {::clerk/width :full} "https://images.unsplash.com/photo-1532879311112-62b7188d28ce?w=1200&h=800&fit=crop")

;; We also support local files for `clerk/image`:
(clerk/image "trees.png")
Expand Down
4 changes: 2 additions & 2 deletions notebooks/viewers/image_layouts.clj
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
[:figure
[:img
{:class "w-full"
:src "https://images.freeimages.com/images/large-previews/773/koldalen-4-1384902.jpg"}]
:src "https://images.unsplash.com/photo-1532879311112-62b7188d28ce?w=1200&h=800&fit=crop"}]
[:figcaption.max-w-prose.text-sm.text-slate-500.sans-serif.mt-2
"Content width, height based on aspect ratio"]])

(clerk/html
[:figure
[:img
{:class "w-full object-cover h-[300px]"
:src "https://images.freeimages.com/images/large-previews/773/koldalen-4-1384902.jpg"}]
:src "https://images.unsplash.com/photo-1532879311112-62b7188d28ce?w=1200&h=800&fit=crop"}]
[:figcaption.text-sm.text-slate-500.sans-serif.mt-2
"Content width, fixed height"]])

Expand Down
4 changes: 2 additions & 2 deletions src/nextjournal/clerk/eval.clj
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@
blocks))

(defn cljs? [doc]
(boolean (and (string? (:file doc))
(str/ends-with? (:file doc) ".cljs"))))
(and (string? (:file doc))
(str/ends-with? (:file doc) ".cljs")))

;; TODO: used in builder to drop analyzer dependency, cfr. below
(defn analyze-doc [doc] (-> doc analyzer/build-graph analyzer/hash))
Expand Down
5 changes: 3 additions & 2 deletions test/nextjournal/clerk/render/hashing_test.clj
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
(ns nextjournal.clerk.render.hashing-test
(:require [clojure.test :refer [deftest is testing]]
(:require [clojure.string :as str]
[clojure.test :refer [deftest is testing]]
[nextjournal.clerk.render.hashing :as hashing]))

(deftest front-end-hash
(testing "it computes a front-end-hash successfully"
(let [debug-dejavu (System/getProperty "nextjournal.dejavu.debug")]
(when-not debug-dejavu
(System/setProperty "nextjournal.dejavu.debug" "1"))
(is (hashing/front-end-hash))
(is (not (str/blank? (hashing/front-end-hash))))
(when-not debug-dejavu
(System/clearProperty "nextjournal.dejavu.debug")))))
Loading