Fix contents for markdown

This commit is contained in:
Tienson Qin
2020-07-23 12:35:44 +08:00
parent 2fa663d85f
commit d0be055e0e
3 changed files with 17 additions and 13 deletions

View File

@@ -116,6 +116,9 @@
edit-id)
(when (string/ends-with? (:heading/content first-heading) "[[]]" )
(js/setTimeout #(util/cursor-move-back (gdom/getElement edit-id) 2)
50))
(when (string/ends-with? (:heading/content first-heading) "[[]]\n---" )
(js/setTimeout #(util/cursor-move-back (gdom/getElement edit-id) 6)
50))))))
state)
:did-update handler/scroll-and-highlight!}

View File

@@ -733,8 +733,8 @@
(let [alias-ids (get-page-alias repo page-name)]
(when (seq alias-ids)
(->> (d/pull-many (get-conn repo)
'[:page/name]
alias-ids)
'[:page/name]
alias-ids)
(map :page/name)
distinct))))
@@ -986,16 +986,17 @@
(let [page (string/lower-case page)
page-id (:db/id (entity repo-url [:page/name page]))
db (get-conn repo-url)]
(some->
(q repo-url [:page/headings page-id]
{:use-cache? true
:transform-fn #(page-headings-transform repo-url %)
:query-fn (fn [db]
(let [datoms (d/datoms db :avet :heading/page page-id)
heading-eids (mapv :e datoms)]
(d/pull-many db '[*] heading-eids)))}
nil)
react))))
(when page-id
(some->
(q repo-url [:page/headings page-id]
{:use-cache? true
:transform-fn #(page-headings-transform repo-url %)
:query-fn (fn [db]
(let [datoms (d/datoms db :avet :heading/page page-id)
heading-eids (mapv :e datoms)]
(d/pull-many db '[*] heading-eids)))}
nil)
react)))))
(defn get-page-directives-content
[page]

View File

@@ -947,7 +947,7 @@
(util/format "#+TITLE: %s\n#+TAGS:\n\n** " title))
"markdown"
(if contents?
(util/format "---\ntitle: %s\nlist: [[]]" title)
(util/format "---\ntitle: %s\nlist: [[]]\n---" title)
(util/format "---\ntitle: %s\ntags:\n---\n\n## " title))
"")))