Просмотр исходного кода

fix: trim whitespaces for block's content

Let's say we have a page like this:
- a
  - b
 b' content

After parsing, block `b` content should be `b\nb' content`
Tienson Qin 2 лет назад
Родитель
Сommit
b1236b4e89
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      deps/graph-parser/src/logseq/graph_parser/mldoc.cljc

+ 1 - 1
deps/graph-parser/src/logseq/graph_parser/mldoc.cljc

@@ -81,7 +81,7 @@
         body (map (fn [line]
         body (map (fn [line]
                     (if (string/blank? (gp-util/safe-subs line 0 level))
                     (if (string/blank? (gp-util/safe-subs line 0 level))
                       (gp-util/safe-subs line level)
                       (gp-util/safe-subs line level)
-                      line))
+                      (string/triml line)))
                (if remove-first-line? lines r))
                (if remove-first-line? lines r))
         content (if remove-first-line? body (cons f body))]
         content (if remove-first-line? body (cons f body))]
     (string/join "\n" content)))
     (string/join "\n" content)))