fix: ignore properties when displaying block's body

This commit is contained in:
Tienson Qin
2021-12-12 16:06:32 +08:00
parent 75436b183a
commit c722f6ec83

View File

@@ -21,6 +21,12 @@
(vector? block)
(= "Heading" (first block))))
(defn properties-block?
[block]
(and
(vector? block)
(= "Properties" (first block))))
(defn get-tag
[block]
(when-let [tag-value (and (vector? block)
@@ -736,9 +742,11 @@
ast (->> (format/to-edn content format (mldoc/default-config format))
(map first))
title (when (heading-block? (first ast))
(:title (second (first ast))))]
(:title (second (first ast))))
body (vec (if title (rest ast) ast))
body (drop-while properties-block? body)]
(cond->
{:block/body (vec (if title (rest ast) ast))}
{:block/body body}
title
(assoc :block/title title))))))