diff --git a/src/main/frontend/external/roam.cljc b/src/main/frontend/external/roam.cljc index f38ec353a..b238aebd1 100644 --- a/src/main/frontend/external/roam.cljc +++ b/src/main/frontend/external/roam.cljc @@ -20,7 +20,7 @@ ;; DONE: 2. merge pages with same names (case-sensitive) ;; DONE: 3. mldoc add support to roam research macros, or we can transform here. ;; DONE: 4. mldoc add support to nested links -;; TODO: 5. Roam attributes -> properties +;; DONE: 5. Roam attributes -> properties ;; TODO: 6. hiccup (defonce uid-pattern #"\(\(([a-zA-Z0-9_\\-]{6,24})\)\)") @@ -82,7 +82,10 @@ (when-not (and (get @uid->uuid uid) uid) (swap! uid->uuid assoc uid (medley/random-uuid))) (let [children-text (children->text children (inc level)) - level-pattern (apply str (repeat level "#")) + level-pattern (str (apply str (repeat level "\t")) + (if (zero? level) + "-" + " -")) properties (when (contains? @all-refed-uids uid) (str (util/format "id:: %s" @@ -101,9 +104,9 @@ (defn ->file [page-data] (let [{:keys [create-time title children edit-time]} page-data - initial-level 2 + initial-level 1 text (when (seq children) - (when-let [text (children->text children initial-level)] + (when-let [text (children->text children (dec initial-level))] (let [front-matter (util/format "---\ntitle: %s\n---\n\n" title)] (str front-matter (transform text)))))] (when (and (not (string/blank? title))