fix: clear indentation for paragraphs

pull/2123/head
Tienson Qin 2021-06-07 18:22:57 +08:00
parent 84b5f97270
commit 3532ecb40c
3 changed files with 7 additions and 8 deletions

View File

@ -1,10 +1,9 @@
(ns frontend.debug
(:require [cljs.pprint :as pprint]
[frontend.config :as config]
[frontend.state :as state]))
(defn pprint
[& xs]
(when (or config/dev? (state/developer-mode?))
(when (state/developer-mode?)
(doseq [x xs]
(pprint/pprint x))))

View File

@ -410,7 +410,7 @@
(defn- remove-indentations
[format level element]
(if (or (= level 1) (= format :org))
(if (= format :org)
element
(case (first element)
"Paragraph"
@ -418,7 +418,7 @@
(let [level (if (= (ffirst (second element)) "Plain")
(count (re-find #"^[\s\t]+" (second (first (second element)))))
level)]
(->> (partition-by #(= ["Break_Line"] %) (second element))
(->> (partition-by #(contains? #{["Break_Line"] ["Hard_Break_Line"]} %) (second element))
(map (fn [c]
(if (and (= (ffirst c) "Plain")
(>= (count (re-find #"^[\s\t]+" (second (first c)))) level))

View File

@ -3917,10 +3917,10 @@ mkdirp@^0.5.4, mkdirp@~0.5.1:
dependencies:
minimist "^1.2.5"
mldoc@0.7.1:
version "0.7.1"
resolved "https://registry.yarnpkg.com/mldoc/-/mldoc-0.7.1.tgz#315f4f288083f141d5d0ecba7d28af8e8e4a5435"
integrity sha512-8eemlusips0cr+L7tYYFmjBo01A/Q1Al8kkXdnH6AnetajhnaSRje/i+kDBj4C4k7FRVdeTJJpiA+1EHqbLhJA==
mldoc@0.7.2:
version "0.7.2"
resolved "https://registry.yarnpkg.com/mldoc/-/mldoc-0.7.2.tgz#c2ec364f504766fee149fe3fde7bde64bf558671"
integrity sha512-EPM9zVJwu7oOQ5d+AmyBJavPqW/XSwsyQ4mAsTXDAa5jiWu0CKcHul35XnFQKNBAQPqM5ao9HEYUydAg5lJh5A==
dependencies:
yargs "^12.0.2"