Skip to content

Commit

Permalink
- bugfix: using the appropriate Quarto target format in Markdown gene…
Browse files Browse the repository at this point in the history
…ration
  • Loading branch information
daslu committed Sep 12, 2024
1 parent cbf20d2 commit 9722992
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 24 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file. This change
- bugfix: handling the edge case of string hiccup carefully
- bugfix: handling `:kind/hidden` correctly in notebook generation
- applying `:kindly/options` in all hiccup-based pathways
- bugfix: using the appropriate Quarto target format in Markdown generation

## [2-beta15] - 2024-07-27
- introducing code-and-value and horizontal layout - WIP (PR #127)
Expand Down
51 changes: 27 additions & 24 deletions src/scicloj/clay/v2/page.clj
Original file line number Diff line number Diff line change
Expand Up @@ -266,30 +266,33 @@
(hiccup.page/html5 head body)))

(defn md [{:as spec
:keys [items title favicon quarto]}]
(str
(->> (cond-> quarto
;; Users may provide non-quarto specific configuration (see also html),
;; if so this will be added to the quarto front-matter to make them behave the same way
title (assoc-in [:format :html :title] title)
favicon (update-in [:format :html :include-in-header :text]
str "<link rel = \"icon\" href = \"" favicon "\" />"))
yaml/generate-string
(format "\n---\n%s\n---\n"))
;; " "
(hiccup/html
[:style (styles/main :table)]
[:style (styles/main :md-main)]
[:style (styles/main :main)])
(->> items
items->deps
(cons :md-default)
(include-libs spec [:js :css]))
(->> items
(map-indexed
(fn [i item]
(prepare/item->md item)))
(string/join "\n\n"))))
:keys [items title favicon quarto format]}]
(let [quarto-target (if (= format [:quarto :revealjs])
:revealjs
:html)]
(str
"\n---\n"
(yaml/generate-string
(cond-> quarto
;; Users may provide non-quarto specific configuration (see also html),
;; if so this will be added to the quarto front-matter to make them behave the same way
title (assoc-in [:format :html :title] title)
favicon (update-in [:format quarto-target :include-in-header :text]
str "<link rel = \"icon\" href = \"" favicon "\" />")))
"\n---\n"
(hiccup/html
[:style (styles/main :table)]
[:style (styles/main :md-main)]
[:style (styles/main :main)])
(->> items
items->deps
(cons :md-default)
(include-libs spec [:js :css]))
(->> items
(map-indexed
(fn [i item]
(prepare/item->md item)))
(string/join "\n\n")))))


(defn hiccup [{:as spec
Expand Down

0 comments on commit 9722992

Please sign in to comment.