File tree Expand file tree Collapse file tree 4 files changed +50
-44
lines changed Expand file tree Collapse file tree 4 files changed +50
-44
lines changed Original file line number Diff line number Diff line change 8
8
* Bump markdown-it to 14.1.0
9
9
* Render ` :code ` according to spec into ` <pre> ` and ` <code> ` block with language class (see [ #39 ] ( https://github.com/nextjournal/markdown/issues/39 ) )
10
10
* No longer depend on ` applied-science/js-interop `
11
+ * Accept parsed result in ` ->hiccup ` function
11
12
12
13
## 0.6.157
13
14
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 45
45
46
46
(defn ->hiccup
47
47
" Turns a markdown string into hiccup."
48
- ([markdown-text] (->hiccup markdown.transform/default-hiccup-renderers markdown-text))
49
- ([ctx markdown-text] (->> markdown-text parse (markdown.transform/->hiccup ctx))))
48
+ ([markdown] (->hiccup markdown.transform/default-hiccup-renderers markdown))
49
+ ([ctx markdown]
50
+ (let [parsed (if (string? markdown)
51
+ (parse markdown)
52
+ markdown)]
53
+ (markdown.transform/->hiccup ctx parsed))))
50
54
51
55
(comment
52
56
(parse " # 🎱 Hello" )
Original file line number Diff line number Diff line change @@ -212,7 +212,10 @@ $$\\int_a^bf(t)dt$$
212
212
[:li
213
213
[:p
214
214
" two" ]]]]
215
- (md/->hiccup markdown-text)))))
215
+ (md/->hiccup markdown-text))))
216
+ (testing " -:hiccup function accepts parsed and string"
217
+ (is (= [:div [:h1 {:id " hello" } " Hello" ]] (md/->hiccup (md/parse " # Hello" ))))
218
+ (is (= [:div [:h1 {:id " hello" } " Hello" ]] (md/->hiccup " # Hello" )))))
216
219
217
220
(deftest strikethrough-test
218
221
(testing " single tilde" )
@@ -1076,7 +1079,6 @@ line
1076
1079
1077
1080
link</a>" )))))))
1078
1081
1079
-
1080
1082
; ; Hello <a href=\"dude\">*Dude*</a>
1081
1083
1082
1084
(comment
You can’t perform that action at this time.
0 commit comments