@@ -43,6 +43,10 @@ some **strong** _assertion_ and a [link] and a $\\pi$ formula
43
43
(+ 1 2 3)
44
44
```
45
45
46
+ ```
47
+ no language
48
+ ```
49
+
46
50
$$\\ int_a^bf(t)dt$$
47
51
48
52
* one
@@ -69,61 +73,64 @@ $$\\int_a^bf(t)dt$$
69
73
70
74
(deftest parse-test
71
75
(testing " ingests markdown returns nested nodes"
72
- (is (= {:type :doc
73
- :footnotes []
74
- :title " 🎱 Hello"
75
- :content [{:content [{:text " 🎱 Hello"
76
- :type :text }]
77
- :heading-level 1
78
- :attrs {:id " hello" }
79
- :emoji " 🎱"
80
- :type :heading }
81
- {:content [{:text " some "
82
- :type :text }
83
- {:content [{:text " strong"
84
- :type :text }]
85
- :type :strong }
86
- {:text " "
87
- :type :text }
88
- {:content [{:text " assertion"
89
- :type :text }]
90
- :type :em }
91
- {:text " and a "
92
- :type :text }
93
- {:attrs {:href " /path/to/something" }
94
- :content [{:text " link"
95
- :type :text }]
96
- :type :link }
97
- {:text " and a "
98
- :type :text }
99
- {:text " \\ pi"
100
- :type :formula }
101
- {:text " formula"
102
- :type :text }]
103
- :type :paragraph }
104
- {:content [{:text " (+ 1 2 3)\n " :type :text }]
105
- :info " clojure"
106
- :language " clojure"
107
- :type :code }
108
- {:text " \\ int_a^bf(t)dt"
109
- :type :block-formula }
110
- {:content [{:content [{:content [{:text " one"
111
- :type :text }]
112
- :type :paragraph }]
113
- :type :list-item }
114
- {:content [{:content [{:text " two"
115
- :type :text }]
116
- :type :paragraph }]
117
- :type :list-item }]
118
- :type :bullet-list }]
119
- :toc {:type :toc
120
- :children [{:type :toc
121
- :content [{:type :text , :text " 🎱 Hello" }]
122
- :heading-level 1
123
- :attrs {:id " hello" }
124
- :emoji " 🎱"
125
- :path [:content 0 ]}]}}
126
- (md/parse markdown-text))))
76
+ (is (match?
77
+ {:type :doc
78
+ :footnotes []
79
+ :title " 🎱 Hello"
80
+ :content [{:content [{:text " 🎱 Hello"
81
+ :type :text }]
82
+ :heading-level 1
83
+ :attrs {:id " hello" }
84
+ :emoji " 🎱"
85
+ :type :heading }
86
+ {:content [{:text " some "
87
+ :type :text }
88
+ {:content [{:text " strong"
89
+ :type :text }]
90
+ :type :strong }
91
+ {:text " "
92
+ :type :text }
93
+ {:content [{:text " assertion"
94
+ :type :text }]
95
+ :type :em }
96
+ {:text " and a "
97
+ :type :text }
98
+ {:attrs {:href " /path/to/something" }
99
+ :content [{:text " link"
100
+ :type :text }]
101
+ :type :link }
102
+ {:text " and a "
103
+ :type :text }
104
+ {:text " \\ pi"
105
+ :type :formula }
106
+ {:text " formula"
107
+ :type :text }]
108
+ :type :paragraph }
109
+ {:content [{:text " (+ 1 2 3)\n " :type :text }]
110
+ :info " clojure"
111
+ :language " clojure"
112
+ :type :code }
113
+ {:content [{:text " no language\n " :type :text }]
114
+ :type :code }
115
+ {:text " \\ int_a^bf(t)dt"
116
+ :type :block-formula }
117
+ {:content [{:content [{:content [{:text " one"
118
+ :type :text }]
119
+ :type :paragraph }]
120
+ :type :list-item }
121
+ {:content [{:content [{:text " two"
122
+ :type :text }]
123
+ :type :paragraph }]
124
+ :type :list-item }]
125
+ :type :bullet-list }]
126
+ :toc {:type :toc
127
+ :children [{:type :toc
128
+ :content [{:type :text , :text " 🎱 Hello" }]
129
+ :heading-level 1
130
+ :attrs {:id " hello" }
131
+ :emoji " 🎱"
132
+ :path [:content 0 ]}]}}
133
+ (md/parse markdown-text))))
127
134
128
135
(testing " parses internal links / plays well with todo lists"
129
136
(is (match? {:type :doc
@@ -175,34 +182,36 @@ $$\\int_a^bf(t)dt$$
175
182
176
183
(deftest ->hiccup-test
177
184
(testing " ingests markdown returns hiccup"
178
- (is (= [:div
179
- [:h1 {:id " hello" } " 🎱 Hello" ]
185
+ (is (match?
186
+ [:div
187
+ [:h1 {:id " hello" } " 🎱 Hello" ]
188
+ [:p
189
+ " some "
190
+ [:strong
191
+ " strong" ]
192
+ " "
193
+ [:em
194
+ " assertion" ]
195
+ " and a "
196
+ [:a
197
+ {:href " /path/to/something" }
198
+ " link" ]
199
+ " and a "
200
+ [:span.formula
201
+ " \\ pi" ]
202
+ " formula" ]
203
+ [:pre [:code.language-clojure " (+ 1 2 3)\n " ]]
204
+ [:pre [:code " no language\n " ]]
205
+ [:figure.formula
206
+ " \\ int_a^bf(t)dt" ]
207
+ [:ul
208
+ [:li
180
209
[:p
181
- " some "
182
- [:strong
183
- " strong" ]
184
- " "
185
- [:em
186
- " assertion" ]
187
- " and a "
188
- [:a
189
- {:href " /path/to/something" }
190
- " link" ]
191
- " and a "
192
- [:span.formula
193
- " \\ pi" ]
194
- " formula" ]
195
- [:pre.viewer-code.not-prose " (+ 1 2 3)\n " ]
196
- [:figure.formula
197
- " \\ int_a^bf(t)dt" ]
198
- [:ul
199
- [:li
200
- [:p
201
- " one" ]]
202
- [:li
203
- [:p
204
- " two" ]]]]
205
- (md/->hiccup markdown-text)))))
210
+ " one" ]]
211
+ [:li
212
+ [:p
213
+ " two" ]]]]
214
+ (md/->hiccup markdown-text)))))
206
215
207
216
(deftest strikethrough-test
208
217
(testing " single tilde" )
0 commit comments