mirror of https://github.com/logseq/logseq
parent
5e5b7d0d01
commit
e8d411b837
|
@ -54,9 +54,9 @@
|
|||
config
|
||||
(or references default-references)))
|
||||
|
||||
(defn default-config
|
||||
(defn default-config-map
|
||||
([format]
|
||||
(default-config format {:export-heading-to-list? false}))
|
||||
(default-config-map format {:export-heading-to-list? false}))
|
||||
([format {:keys [export-heading-to-list? export-keep-properties? export-md-indent-style export-md-remove-options parse_outline_only?]}]
|
||||
(let [format (string/capitalize (name (or format :markdown)))]
|
||||
(->> {:toc false
|
||||
|
@ -70,9 +70,15 @@
|
|||
:export_md_remove_options
|
||||
(convert-export-md-remove-options export-md-remove-options)}
|
||||
(filter #(not (nil? (second %))))
|
||||
(into {})
|
||||
(bean/->js)
|
||||
js/JSON.stringify))))
|
||||
(into {})))))
|
||||
|
||||
(defn default-config
|
||||
([format]
|
||||
(default-config format {:export-heading-to-list? false}))
|
||||
([format opts]
|
||||
(->> (default-config-map format opts)
|
||||
bean/->js
|
||||
js/JSON.stringify)))
|
||||
|
||||
(defn remove-indentation-spaces
|
||||
"Remove the indentation spaces from the content. Only for markdown.
|
||||
|
|
|
@ -130,7 +130,7 @@
|
|||
"jszip": "3.8.0",
|
||||
"katex": "^0.16.7",
|
||||
"marked": "^5.1.2",
|
||||
"mldoc": "1.5.7",
|
||||
"mldoc": "^1.5.8",
|
||||
"path": "0.12.7",
|
||||
"path-complete-extname": "1.0.0",
|
||||
"pdfjs-dist": "^3.9.179",
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
[lambdaisland.glogi :as log]
|
||||
[frontend.util :as util]
|
||||
[datascript.core :as d]
|
||||
[logseq.db.frontend.property :as db-property]))
|
||||
[logseq.db.frontend.property :as db-property]
|
||||
[cljs-bean.core :as bean]))
|
||||
|
||||
(defn- update-extracted-block-properties
|
||||
"Updates DB graph blocks to ensure that built-in properties are using uuids
|
||||
|
@ -114,6 +115,16 @@ and handles unexpected failure."
|
|||
(remove nil?)
|
||||
(first)))
|
||||
|
||||
(defn- get-db-based-parse-config
|
||||
[format]
|
||||
(let [db-based? (config/db-based-graph? (state/get-current-repo))]
|
||||
(->>
|
||||
(cond-> (gp-mldoc/default-config-map format)
|
||||
db-based?
|
||||
(assoc :enable_drawers false))
|
||||
bean/->js
|
||||
js/JSON.stringify)))
|
||||
|
||||
(defn parse-block
|
||||
([block]
|
||||
(parse-block block nil))
|
||||
|
@ -122,7 +133,8 @@ and handles unexpected failure."
|
|||
(when-not (string/blank? content)
|
||||
(let [block (dissoc block :block/pre-block?)
|
||||
format (or format :markdown)
|
||||
ast (format/to-edn content format nil)
|
||||
parse-config (get-db-based-parse-config format)
|
||||
ast (format/to-edn content format parse-config)
|
||||
blocks (extract-blocks ast content format {:with-id? with-id?})
|
||||
new-block (first blocks)
|
||||
block (cond->
|
||||
|
@ -146,7 +158,8 @@ and handles unexpected failure."
|
|||
(str (config/get-block-pattern format) " " (string/triml content)))]
|
||||
(if-let [result (state/get-block-ast block-uuid content)]
|
||||
result
|
||||
(let [ast (->> (format/to-edn content format (gp-mldoc/default-config format))
|
||||
(let [parse-config (get-db-based-parse-config format)
|
||||
ast (->> (format/to-edn content format parse-config)
|
||||
(map first))
|
||||
title (when (gp-block/heading-block? (first ast))
|
||||
(:title (second (first ast))))
|
||||
|
|
|
@ -2432,6 +2432,7 @@
|
|||
current-node (outliner-core/block block)
|
||||
has-right? (-> (tree/-get-right current-node)
|
||||
(tree/satisfied-inode?))
|
||||
db-based? (config/db-based-graph? (state/get-current-repo))
|
||||
thing-at-point ;intern is not supported in cljs, need a more elegant solution
|
||||
(or (when (thingatpt/get-setting :admonition&src?)
|
||||
(thingatpt/admonition&src-at-point input))
|
||||
|
@ -2441,7 +2442,7 @@
|
|||
(thingatpt/block-ref-at-point input))
|
||||
(when (thingatpt/get-setting :page-ref?)
|
||||
(thingatpt/page-ref-at-point input))
|
||||
(when (thingatpt/get-setting :properties?)
|
||||
(when (and (not db-based?) (thingatpt/get-setting :properties?))
|
||||
(thingatpt/properties-at-point input))
|
||||
(when (thingatpt/get-setting :list?)
|
||||
(and (not (cursor/beginning-of-line? input))
|
||||
|
|
|
@ -5026,10 +5026,10 @@ mkdirp@^1.0.3:
|
|||
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
|
||||
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==
|
||||
|
||||
mldoc@1.5.7:
|
||||
version "1.5.7"
|
||||
resolved "https://registry.yarnpkg.com/mldoc/-/mldoc-1.5.7.tgz#9b316f633a3032ce217a339621b98e70bb229235"
|
||||
integrity sha512-Ph9y8t195UWtkn0hK/VVNvi/wjZUJCLXAaUGVE80KmaE9Rwp9wWBMSEg4wPgjCac3edMjaONucD52fHOFTU9UA==
|
||||
mldoc@^1.5.8:
|
||||
version "1.5.8"
|
||||
resolved "https://registry.yarnpkg.com/mldoc/-/mldoc-1.5.8.tgz#5433950c9124f8917075bafa4f1ed886959504c5"
|
||||
integrity sha512-wNUGgwdgB/5c3GTp2qRPzWD8CpeTmA/HDlGJjTJUo2WXJttiBaz8cHQh2OdAshiLdVxteqIaSTXSPFRf7z1YRw==
|
||||
dependencies:
|
||||
yargs "^12.0.2"
|
||||
|
||||
|
|
Loading…
Reference in New Issue