Skip to content

Commit a761750

Browse files
committed
Fix merge order of empty-doc
1 parent cdcecc7 commit a761750

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Unreleased
66

7-
...
7+
- Fix merge order of options and `empty-doc`
88

99
## 0.7.211
1010

src/nextjournal/markdown/impl.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@
287287
(set (keys ctx))
288288
(set (keys u/empty-doc))))
289289
;; only settings were provided, we add the empty doc
290-
(recur (merge ctx u/empty-doc) md)
290+
(recur (merge u/empty-doc ctx) md)
291291
(node->data (update ctx :text-tokenizers (partial map u/normalize-tokenizer))
292292
(.parse (parser ctx) md)))))
293293

src/nextjournal/markdown/impl.cljs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
;; # 🧩 Parsing
22
(ns nextjournal.markdown.impl
33
(:require ["/js/markdown" :as md]
4+
[clojure.set :as set]
45
[clojure.zip :as z]
56
[nextjournal.markdown.impl.utils :as u]))
67

@@ -276,7 +277,9 @@ _this #should be a tag_, but this [_actually #foo shouldnt_](/bar/) is not."
276277
(defn parse
277278
([markdown] (parse u/empty-doc markdown))
278279
([ctx-in markdown]
279-
(if (empty? (select-keys ctx-in [:type :content ::root]))
280+
(if (not (set/superset?
281+
(set (keys ctx-in))
282+
(set (keys u/empty-doc))))
280283
(recur (merge u/empty-doc ctx-in) markdown)
281284
(let [{:as ctx-out :keys [doc title toc footnotes] ::keys [label->footnote-ref]}
282285
(-> ctx-in

0 commit comments

Comments
 (0)