Skip to content

Commit

Permalink
Simplify with drop-last/last
Browse files Browse the repository at this point in the history
  • Loading branch information
philippamarkovics committed Nov 9, 2023
1 parent aee782a commit 6557c0c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/nextjournal/clerk/viewer.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -788,12 +788,11 @@
mark-presented
(update :nextjournal/value
(fn [{:as node :keys [text content] ::keys [doc]}]
(let [main-col (filter #(not= (:type %) :sidenote-column) content)
sidenote-col (filter #(= (:type %) :sidenote-column) content)]
(into
[:div.sidenote-container
(into [:div.sidenote-main-col] (mapv (partial apply-viewers-to-md viewers doc) main-col))]
(mapv (partial apply-viewers-to-md viewers doc) sidenote-col)))))))}
[:div.sidenote-container
(into [:div.sidenote-main-col]
(map (partial apply-viewers-to-md viewers doc))
(drop-last content))
(apply-viewers-to-md viewers doc (last content))]))))}
{:name :nextjournal.markdown/sidenote-column :transform-fn (into-markup [:div.sidenote-column])}
{:name :nextjournal.markdown/sidenote
:transform-fn (into-markup (fn [{:keys [ref]}]
Expand Down

0 comments on commit 6557c0c

Please sign in to comment.