mirror of https://github.com/logseq/logseq
fix: export indentation for block content
parent
07f60a7950
commit
e69b155ca2
|
@ -73,7 +73,7 @@
|
|||
"ignore": "^5.1.8",
|
||||
"is-svg": "4.2.2",
|
||||
"jszip": "^3.5.0",
|
||||
"mldoc": "0.6.11",
|
||||
"mldoc": "0.6.13",
|
||||
"path": "^0.12.7",
|
||||
"react": "^17.0.1",
|
||||
"react-dom": "^17.0.1",
|
||||
|
|
|
@ -15,26 +15,32 @@
|
|||
[frontend.modules.outliner.tree :as tree]
|
||||
[promesa.core :as p]))
|
||||
|
||||
(defn- indented-block-content
|
||||
[content spaces-tabs]
|
||||
(let [lines (string/split-lines content)]
|
||||
(string/join (str "\n" spaces-tabs) lines)))
|
||||
|
||||
(defn transform-content
|
||||
[{:block/keys [format pre-block? content unordered]} level]
|
||||
(let [content (or content "")]
|
||||
(if pre-block?
|
||||
(string/trim content)
|
||||
(let [prefix (cond
|
||||
(= format :org)
|
||||
(->>
|
||||
(repeat level "*")
|
||||
(apply str))
|
||||
(let [[prefix spaces-tabs]
|
||||
(cond
|
||||
(= format :org)
|
||||
[(->>
|
||||
(repeat level "*")
|
||||
(apply str)) ""]
|
||||
|
||||
(and (= format :markdown) (not unordered)) ; heading
|
||||
""
|
||||
(and (= format :markdown) (not unordered)) ; heading
|
||||
["" ""]
|
||||
|
||||
:else
|
||||
(str (->>
|
||||
(repeat (dec level) (state/get-export-bullet-indentation))
|
||||
(apply str))
|
||||
"-")) ; TODO:
|
||||
new-content (string/trim content)]
|
||||
:else
|
||||
(let [spaces-tabs (->>
|
||||
(repeat (dec level) (state/get-export-bullet-indentation))
|
||||
(apply str))]
|
||||
[(str spaces-tabs "-") (str spaces-tabs " ")]))
|
||||
new-content (indented-block-content (string/trim content) spaces-tabs)]
|
||||
(str prefix " " new-content)))))
|
||||
|
||||
(defn tree->file-content
|
||||
|
|
|
@ -3853,10 +3853,10 @@ mkdirp@^0.5.4, mkdirp@~0.5.1:
|
|||
dependencies:
|
||||
minimist "^1.2.5"
|
||||
|
||||
mldoc@0.6.11:
|
||||
version "0.6.11"
|
||||
resolved "https://registry.yarnpkg.com/mldoc/-/mldoc-0.6.11.tgz#8174ff837a9a66318480061f4f25a795507ef4b6"
|
||||
integrity sha512-FoGbsqxUEJYXK/K5YtqVOifmxeS93/fvMuSV+WcsrxxQyT/nXRV0biUiqKgKJYoApdhq96p/eNMTKhIfTdI+lw==
|
||||
mldoc@0.6.13:
|
||||
version "0.6.13"
|
||||
resolved "https://registry.yarnpkg.com/mldoc/-/mldoc-0.6.13.tgz#bb8cba40ec512717e06e9dd4a668f4a05d479503"
|
||||
integrity sha512-Vllx8zxUNB/M2FQJYHyuJ0096JOPhl1idAimp65Fk/vmMkG4DlMC/VWKCtaReHx8lOZ1uGFobkHMlvJOuyOsAA==
|
||||
dependencies:
|
||||
yargs "^12.0.2"
|
||||
|
||||
|
|
Loading…
Reference in New Issue