Skip to content

Commit c91661f

Browse files
fix: import code block inside quote block
Fixes logseq/db-test#523
1 parent 2c6f810 commit c91661f

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

deps/graph-parser/src/logseq/graph_parser/exporter.cljs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,10 @@
871871
(let [[type' content] (second node)
872872
wrapper (case type' "Inline" "$" "Displayed" "$$")]
873873
[wrapper content wrapper])
874+
(and (vector? node) (= (first node) "Src"))
875+
[(str "\n```" (when-let [lang (:language (second node))] lang))
876+
(apply str "\n" (:lines (second node)))
877+
"```"]
874878
(and (vector? node) (= (first node) "Displayed_Math"))
875879
["$$" (second node) "$$"]
876880
(and (vector? node) (= (first node) "List"))

deps/graph-parser/test/logseq/graph_parser/exporter_test.cljs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,13 @@
210210

211211
;; Counts
212212
;; Includes journals as property values e.g. :logseq.property/deadline
213-
(is (= 29 (count (d/q '[:find ?b :where [?b :block/tags :logseq.class/Journal]] @conn))))
213+
(is (= 30 (count (d/q '[:find ?b :where [?b :block/tags :logseq.class/Journal]] @conn))))
214214

215215
(is (= 5 (count (d/q '[:find ?b :where [?b :block/tags :logseq.class/Asset]] @conn))))
216216
(is (= 4 (count (d/q '[:find ?b :where [?b :block/tags :logseq.class/Task]] @conn))))
217217
(is (= 4 (count (d/q '[:find ?b :where [?b :block/tags :logseq.class/Query]] @conn))))
218218
(is (= 2 (count (d/q '[:find ?b :where [?b :block/tags :logseq.class/Card]] @conn))))
219-
(is (= 4 (count (d/q '[:find ?b :where [?b :block/tags :logseq.class/Quote-block]] @conn))))
219+
(is (= 5 (count (d/q '[:find ?b :where [?b :block/tags :logseq.class/Quote-block]] @conn))))
220220
(is (= 2 (count (d/q '[:find ?b :where [?b :block/tags :logseq.class/Pdf-annotation]] @conn))))
221221

222222
;; Properties and tags aren't included in this count as they aren't a Page
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- #+BEGIN_QUOTE
2+
test a code block in a quote:
3+
4+
```shell
5+
$ echo hi
6+
$ echo gbye
7+
```
8+
#+END_QUOTE

0 commit comments

Comments
 (0)