mirror of
https://github.com/logseq/logseq.git
synced 2026-02-01 22:47:36 +00:00
fix: remove org mode everywhere except graph-parser
This commit is contained in:
17
deps/common/src/logseq/common/config.cljs
vendored
17
deps/common/src/logseq/common/config.cljs
vendored
@@ -72,14 +72,6 @@
|
||||
[path]
|
||||
(string/starts-with? path default-draw-directory))
|
||||
|
||||
;; TODO: rename
|
||||
(defonce mldoc-support-formats
|
||||
#{:org :markdown :md})
|
||||
|
||||
(defn mldoc-support?
|
||||
[format]
|
||||
(contains? mldoc-support-formats (keyword format)))
|
||||
|
||||
(defn text-formats
|
||||
[]
|
||||
#{:json :org :md :yml :dat :asciidoc :rst :txt :markdown :adoc :html :js :ts :edn :clj :ml :rb :ex :erl :java :php :c :css
|
||||
@@ -89,14 +81,7 @@
|
||||
[]
|
||||
#{:gif :svg :jpeg :ico :png :jpg :bmp :webp})
|
||||
|
||||
(defn get-block-pattern
|
||||
[format]
|
||||
(let [format' (keyword format)]
|
||||
(case format'
|
||||
:org
|
||||
"*"
|
||||
|
||||
"-")))
|
||||
(defonce block-pattern "-")
|
||||
|
||||
(def file-only-config
|
||||
"File only config keys that are deprecated in DB graphs along with
|
||||
|
||||
19
deps/common/src/logseq/common/util/page_ref.cljs
vendored
19
deps/common/src/logseq/common/util/page_ref.cljs
vendored
@@ -2,7 +2,7 @@
|
||||
"Core vars and util fns for page-ref. Currently this only handles a logseq
|
||||
page-ref e.g. [[page name]]"
|
||||
(:require [clojure.string :as string]
|
||||
["path" :as path]))
|
||||
["path" :as node-path]))
|
||||
|
||||
(def left-brackets "Opening characters for page-ref" "[[")
|
||||
(def right-brackets "Closing characters for page-ref" "]]")
|
||||
@@ -13,20 +13,13 @@
|
||||
(def page-ref-re "Inner capture and doesn't match nested brackets" #"\[\[(.*?)\]\]")
|
||||
(def page-ref-without-nested-re "Matches most inner nested brackets" #"\[\[([^\[\]]+)\]\]")
|
||||
(def page-ref-any-re "Inner capture that matches anything between brackets" #"\[\[(.*)\]\]")
|
||||
(def org-page-ref-re #"\[\[(file:.*)\]\[.+?\]\]")
|
||||
(def markdown-page-ref-re #"\[(.*)\]\(file:.*\)")
|
||||
|
||||
(defn get-file-basename
|
||||
"Returns the basename of a file path. e.g. /a/b/c.md -> c.md"
|
||||
[path]
|
||||
(when-not (string/blank? path)
|
||||
(.-base (path/parse (string/replace path "+" "/")))))
|
||||
|
||||
(defn get-file-rootname
|
||||
"Returns the rootname of a file path. e.g. /a/b/c.md -> c"
|
||||
[path]
|
||||
(when-not (string/blank? path)
|
||||
(.-name (path/parse (string/replace path "+" "/")))))
|
||||
(.-base (node-path/parse (string/replace path "+" "/")))))
|
||||
|
||||
(defn page-ref?
|
||||
"Determines if string is page-ref. Avoid using with format-specific page-refs e.g. org"
|
||||
@@ -40,16 +33,12 @@
|
||||
(str left-brackets page-name right-brackets))
|
||||
|
||||
(defn get-page-name
|
||||
"Extracts page names from format-specific page-refs e.g. org/md specific and
|
||||
logseq page-refs. Only call in contexts where format-specific page-refs are
|
||||
used. For logseq page-refs use page-ref/get-page-name"
|
||||
"Extracts page names from md page-refs or logseq page-refs. Only call in
|
||||
contexts where md page-refs are used"
|
||||
[s]
|
||||
(and (string? s)
|
||||
(or (when-let [[_ label _path] (re-matches markdown-page-ref-re s)]
|
||||
(string/trim label))
|
||||
(when-let [[_ path _label] (re-matches org-page-ref-re s)]
|
||||
(some-> (get-file-rootname path)
|
||||
(string/replace "." "/")))
|
||||
(-> (re-matches page-ref-any-re s)
|
||||
second))))
|
||||
|
||||
|
||||
@@ -37,7 +37,8 @@
|
||||
[logseq.graph-parser.extract :as extract]
|
||||
[logseq.graph-parser.property :as gp-property]
|
||||
[logseq.graph-parser.utf8 :as utf8]
|
||||
[promesa.core :as p]))
|
||||
[promesa.core :as p]
|
||||
[logseq.graph-parser.text :as text]))
|
||||
|
||||
(defn- add-missing-timestamps
|
||||
"Add updated-at or created-at timestamps if they doesn't exist"
|
||||
@@ -1339,7 +1340,7 @@
|
||||
(cond
|
||||
(page-ref/page-ref? (str (first (:arguments (second embed-node)))))
|
||||
(let [page-uuid (get-page-uuid page-names-to-uuids
|
||||
(some-> (page-ref/get-page-name (first (:arguments (second embed-node))))
|
||||
(some-> (text/get-page-name (first (:arguments (second embed-node))))
|
||||
common-util/page-name-sanity-lc)
|
||||
{:block block})]
|
||||
(merge block
|
||||
@@ -1766,11 +1767,16 @@
|
||||
(update :block/refs fix-block-uuids {:ref? true :properties (:block/properties b)})))
|
||||
blocks)))
|
||||
|
||||
(defn- get-block-pattern
|
||||
[format]
|
||||
(let [format' (keyword format)]
|
||||
(if (= format' :org) "*" "-")))
|
||||
|
||||
(defn- extract-pages-and-blocks
|
||||
"Main fn which calls graph-parser to convert markdown into data"
|
||||
[db file content {:keys [extract-options import-state]}]
|
||||
(let [format (common-util/get-format file)
|
||||
extract-options' (merge {:block-pattern (common-config/get-block-pattern format)
|
||||
extract-options' (merge {:block-pattern (get-block-pattern format)
|
||||
:date-formatter "MMM do, yyyy"
|
||||
:uri-encoded? false
|
||||
;; Alters behavior in gp-block
|
||||
@@ -1779,7 +1785,7 @@
|
||||
extract-options
|
||||
{:db db})
|
||||
extracted
|
||||
(cond (contains? common-config/mldoc-support-formats format)
|
||||
(cond (contains? #{:org :markdown :md} format)
|
||||
(-> (extract/extract file content extract-options')
|
||||
(update :pages (fn [pages]
|
||||
(map #(dissoc % :block.temp/original-page-name) pages)))
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
[clojure.string :as string]
|
||||
[clojure.walk :as walk]
|
||||
[datascript.core :as d]
|
||||
[logseq.common.config :as common-config]
|
||||
[logseq.common.util :as common-util]
|
||||
[logseq.db :as ldb]
|
||||
[logseq.graph-parser.block :as gp-block]
|
||||
@@ -20,12 +19,16 @@
|
||||
[logseq.graph-parser.whiteboard :as gp-whiteboard]
|
||||
[medley.core :as medley]))
|
||||
|
||||
(defn- mldoc-support?
|
||||
[format']
|
||||
(contains? #{:org :markdown :md} (keyword format')))
|
||||
|
||||
(defn- filepath->page-name
|
||||
[filepath]
|
||||
(when-let [file-name (last (string/split filepath #"/"))]
|
||||
(let [result (first (common-util/split-last "." file-name))
|
||||
ext (string/lower-case (common-util/get-file-ext filepath))]
|
||||
(if (or (common-config/mldoc-support? ext) (= "edn" ext))
|
||||
(if (or (mldoc-support? ext) (= "edn" ext))
|
||||
(common-util/safe-decode-uri-component (string/replace result "." "/"))
|
||||
result))))
|
||||
|
||||
@@ -117,7 +120,7 @@
|
||||
(string? title)
|
||||
title))
|
||||
file-name (when-let [result (path->file-body file)]
|
||||
(if (common-config/mldoc-support? (common-util/get-file-ext file))
|
||||
(if (mldoc-support? (common-util/get-file-ext file))
|
||||
(title-parsing result filename-format)
|
||||
result))]
|
||||
(or property-name
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
(ns logseq.graph-parser.text
|
||||
"Miscellaneous text util fns for the parser. Used by file and DB graphs"
|
||||
(:require [clojure.set :as set]
|
||||
(:require ["path" :as node-path]
|
||||
[clojure.set :as set]
|
||||
[clojure.string :as string]
|
||||
[goog.string :as gstring]
|
||||
[logseq.common.util :as common-util]
|
||||
@@ -11,7 +12,23 @@
|
||||
|
||||
(def get-file-basename page-ref/get-file-basename)
|
||||
|
||||
(def get-page-name page-ref/get-page-name)
|
||||
(defn- get-file-rootname
|
||||
"Returns the rootname of a file path. e.g. /a/b/c.md -> c"
|
||||
[path]
|
||||
(when-not (string/blank? path)
|
||||
(.-name (node-path/parse (string/replace path "+" "/")))))
|
||||
|
||||
(defn get-page-name
|
||||
"Similar to page-ref/get-page-name but handles format-specific page-refs e.g. org/md"
|
||||
[s]
|
||||
(and (string? s)
|
||||
(or (when-let [[_ label _path] (re-matches page-ref/markdown-page-ref-re s)]
|
||||
(string/trim label))
|
||||
(when-let [[_ path _label] (re-matches #"\[\[(file:.*)\]\[.+?\]\]" s)]
|
||||
(some-> (get-file-rootname path)
|
||||
(string/replace "." "/")))
|
||||
(-> (re-matches page-ref/page-ref-any-re s)
|
||||
second))))
|
||||
|
||||
(def page-ref-un-brackets! page-ref/page-ref-un-brackets!)
|
||||
|
||||
@@ -75,7 +92,7 @@
|
||||
nil)
|
||||
|
||||
"Nested_link"
|
||||
(page-ref/get-page-name (:content data))
|
||||
(get-page-name (:content data))
|
||||
|
||||
"Tag"
|
||||
(if (= "Plain" (ffirst data))
|
||||
|
||||
@@ -134,9 +134,7 @@
|
||||
[url]
|
||||
(match url
|
||||
["File" s]
|
||||
(-> (string/replace s "file://" "")
|
||||
;; "file:/Users/ll/Downloads/test.pdf" is a normal org file link
|
||||
(string/replace "file:" ""))
|
||||
(string/replace s "file://" "")
|
||||
|
||||
["Complex" m]
|
||||
(let [{:keys [link protocol]} m]
|
||||
@@ -1117,21 +1115,9 @@
|
||||
[:span.text-gray-500 page-ref/right-brackets])]))
|
||||
|
||||
(defn- show-link?
|
||||
[config metadata s full-text]
|
||||
(let [media-formats (set (map name config/media-formats))
|
||||
metadata-show (:show (common-util/safe-read-map-string metadata))
|
||||
format (get-in config [:block :block/format] :markdown)]
|
||||
[s full-text]
|
||||
(let [media-formats (set (map name config/media-formats))]
|
||||
(or
|
||||
(and
|
||||
(= :org format)
|
||||
(or
|
||||
(and
|
||||
(nil? metadata-show)
|
||||
(or
|
||||
(common-config/local-relative-asset? s)
|
||||
(text-util/media-link? media-formats s)))
|
||||
(true? (boolean metadata-show))))
|
||||
|
||||
;; markdown
|
||||
(string/starts-with? (string/triml full-text) "!")
|
||||
|
||||
@@ -1214,7 +1200,7 @@
|
||||
:target "_blank"}
|
||||
(map-inline config label))
|
||||
|
||||
(show-link? config metadata s full_text)
|
||||
(show-link? s full_text)
|
||||
(media-link config url s label metadata full_text)
|
||||
|
||||
(util/electron?)
|
||||
@@ -1257,15 +1243,10 @@
|
||||
id label*)))
|
||||
|
||||
["Page_ref" page]
|
||||
(let [format (get-in config [:block :block/format] :markdown)]
|
||||
(if (and (= format :org)
|
||||
(show-link? config nil page page)
|
||||
(not (contains? #{"pdf" "mp4" "ogg" "webm"} (util/get-file-ext page))))
|
||||
(image-link config url page nil metadata full_text)
|
||||
(let [label* (if (seq (mldoc/plain->text label)) label nil)]
|
||||
(if (and (string? page) (string/blank? page))
|
||||
[:span (ref/->page-ref page)]
|
||||
(page-reference config page label*)))))
|
||||
(let [label* (if (seq (mldoc/plain->text label)) label nil)]
|
||||
(if (and (string? page) (string/blank? page))
|
||||
[:span (ref/->page-ref page)]
|
||||
(page-reference config page label*)))
|
||||
|
||||
["Embed_data" src]
|
||||
(image-link config url src nil metadata full_text)
|
||||
@@ -1282,15 +1263,8 @@
|
||||
(assoc :link-js-url (try (js/URL. href)
|
||||
(catch :default _ nil))))]
|
||||
(cond
|
||||
(and (= (get-in config [:block :block/format] :markdown) :org)
|
||||
(= "Complex" protocol)
|
||||
(= (string/lower-case (:protocol path)) "id")
|
||||
(string? (:link path))
|
||||
(util/uuid-string? (:link path))) ; org mode id
|
||||
(block-reference config (:link path) label)
|
||||
|
||||
(= protocol "file")
|
||||
(if (show-link? config metadata href full_text)
|
||||
(if (show-link? href full_text)
|
||||
(media-link config url href label metadata full_text)
|
||||
(let [href* (if (util/electron?)
|
||||
(relative-assets-path->absolute-path href)
|
||||
@@ -1310,7 +1284,7 @@
|
||||
title (assoc :title title))
|
||||
(map-inline config label))]))
|
||||
|
||||
(show-link? config metadata href full_text)
|
||||
(show-link? href full_text)
|
||||
(media-link config url href label metadata full_text)
|
||||
|
||||
:else
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
(ns frontend.components.shortcut-help
|
||||
"Shortcut help"
|
||||
(:require [frontend.context.i18n :refer [t]]
|
||||
[frontend.state :as state]
|
||||
[frontend.extensions.latex :as latex]
|
||||
[frontend.extensions.highlight :as highlight]
|
||||
[logseq.common.util.block-ref :as block-ref]
|
||||
@@ -37,38 +36,19 @@
|
||||
[:td.text-left (t :help/context-menu)]
|
||||
[:td.text-right [:code "Right click bullet"]]]]])
|
||||
|
||||
(defn markdown-and-orgmode-syntax []
|
||||
(defn markdown-syntax []
|
||||
(let [list [:bold :italics :del :mark :latex :code :link :pre :img]
|
||||
|
||||
preferred-format (state/get-preferred-format) ; markdown/org
|
||||
|
||||
title (case preferred-format
|
||||
:markdown (t :help/markdown-syntax)
|
||||
:org (t :help/org-mode-syntax))
|
||||
|
||||
learn-more (case preferred-format
|
||||
:markdown "https://www.markdownguide.org/basic-syntax"
|
||||
:org "https://orgmode.org/worg/dev/org-syntax.html")
|
||||
|
||||
raw (case preferred-format
|
||||
:markdown {:bold (str "**" (t :bold) "**")
|
||||
:italics (str "_" (t :italics) "_")
|
||||
:link "[Link](https://www.example.com)"
|
||||
:del (str "~~" (t :strikethrough) "~~")
|
||||
:mark (str "^^" (t :highlight) "^^")
|
||||
:latex "$$E = mc^2$$"
|
||||
:code (str "`" (t :code) "`")
|
||||
:pre "```clojure\n (println \"Hello world!\")\n```"
|
||||
:img ""}
|
||||
:org {:bold (str "*" (t :bold) "*")
|
||||
:italics (str "/" (t :italics) "/")
|
||||
:del (str "+" (t :strikethrough) "+")
|
||||
:pre [:pre "#+BEGIN_SRC clojure\n (println \"Hello world!\")\n#+END_SRC"]
|
||||
:link "[[https://www.example.com][Link]]"
|
||||
:mark (str "^^" (t :highlight) "^^")
|
||||
:latex "$$E = mc^2$$"
|
||||
:code "~Code~"
|
||||
:img "[[https://asset.logseq.com/static/img/logo.png][image]]"})
|
||||
title (t :help/markdown-syntax)
|
||||
learn-more "https://www.markdownguide.org/basic-syntax"
|
||||
raw {:bold (str "**" (t :bold) "**")
|
||||
:italics (str "_" (t :italics) "_")
|
||||
:link "[Link](https://www.example.com)"
|
||||
:del (str "~~" (t :strikethrough) "~~")
|
||||
:mark (str "^^" (t :highlight) "^^")
|
||||
:latex "$$E = mc^2$$"
|
||||
:code (str "`" (t :code) "`")
|
||||
:pre "```clojure\n (println \"Hello world!\")\n```"
|
||||
:img ""}
|
||||
|
||||
rendered {:italics [:i (t :italics)]
|
||||
:bold [:b (t :bold)]
|
||||
@@ -101,5 +81,5 @@
|
||||
{:class "-mt-2"}
|
||||
(when show-title? [:h1.title (t :help/shortcut-page-title)])
|
||||
(trigger-table)
|
||||
(markdown-and-orgmode-syntax)
|
||||
(markdown-syntax)
|
||||
(shortcut/shortcut-keymap-x)])
|
||||
|
||||
@@ -115,18 +115,10 @@
|
||||
(when-not util/node-test?
|
||||
(util/safe-re-find #"Mobi" js/navigator.userAgent)))
|
||||
|
||||
;; TODO: protocol design for future formats support
|
||||
|
||||
(defn get-block-pattern
|
||||
[format]
|
||||
(common-config/get-block-pattern (or format (state/get-preferred-format))))
|
||||
|
||||
(defn get-hr
|
||||
[format]
|
||||
(let [format (or format (keyword (state/get-preferred-format)))]
|
||||
(case format
|
||||
:org
|
||||
"-----"
|
||||
:markdown
|
||||
"---"
|
||||
"")))
|
||||
@@ -135,8 +127,6 @@
|
||||
[format]
|
||||
(let [format (or format (keyword (state/get-preferred-format)))]
|
||||
(case format
|
||||
:org
|
||||
"*"
|
||||
:markdown
|
||||
"**"
|
||||
"")))
|
||||
@@ -145,8 +135,6 @@
|
||||
[format]
|
||||
(let [format (or format (keyword (state/get-preferred-format)))]
|
||||
(case format
|
||||
:org
|
||||
"/"
|
||||
:markdown
|
||||
"*"
|
||||
"")))
|
||||
@@ -154,8 +142,6 @@
|
||||
[format]
|
||||
(let [format (or format (keyword (state/get-preferred-format)))]
|
||||
(case format
|
||||
:org
|
||||
"_"
|
||||
:markdown ;; no underline for markdown
|
||||
""
|
||||
"")))
|
||||
@@ -163,8 +149,6 @@
|
||||
[format]
|
||||
(let [format (or format (keyword (state/get-preferred-format)))]
|
||||
(case format
|
||||
:org
|
||||
"+"
|
||||
:markdown
|
||||
"~~"
|
||||
"")))
|
||||
@@ -172,8 +156,6 @@
|
||||
(defn get-highlight
|
||||
[format]
|
||||
(case format
|
||||
:org
|
||||
"^^"
|
||||
:markdown
|
||||
"=="
|
||||
""))
|
||||
@@ -182,8 +164,6 @@
|
||||
[format]
|
||||
(let [format (or format (keyword (state/get-preferred-format)))]
|
||||
(case format
|
||||
:org
|
||||
"~"
|
||||
:markdown
|
||||
"`"
|
||||
"")))
|
||||
@@ -191,28 +171,19 @@
|
||||
(defn get-empty-link-and-forward-pos
|
||||
[format]
|
||||
(case format
|
||||
:org
|
||||
["[[][]]" 2]
|
||||
:markdown
|
||||
["[]()" 1]
|
||||
["" 0]))
|
||||
|
||||
(defn link-format
|
||||
[format label link]
|
||||
[label link]
|
||||
(if (not-empty label)
|
||||
(case format
|
||||
:org
|
||||
(util/format "[[%s][%s]]" link label)
|
||||
:markdown
|
||||
(util/format "[%s](%s)" label link))
|
||||
(util/format "[%s](%s)" label link)
|
||||
link))
|
||||
|
||||
(defn with-default-link
|
||||
[format link]
|
||||
(case format
|
||||
:org
|
||||
[(util/format "[[%s][]]" link)
|
||||
(+ 4 (count link))]
|
||||
:markdown
|
||||
[(util/format "[](%s)" link)
|
||||
1]
|
||||
@@ -221,9 +192,6 @@
|
||||
(defn with-label-link
|
||||
[format label link]
|
||||
(case format
|
||||
:org
|
||||
[(util/format "[[%s][%s]]" link label)
|
||||
(+ 4 (count link) (count label))]
|
||||
:markdown
|
||||
[(util/format "[%s](%s)" label link)
|
||||
(+ 4 (count link) (count label))]
|
||||
@@ -232,9 +200,6 @@
|
||||
(defn with-default-label
|
||||
[format label]
|
||||
(case format
|
||||
:org
|
||||
[(util/format "[[][%s]]" label)
|
||||
2]
|
||||
:markdown
|
||||
[(util/format "[%s]()" label)
|
||||
(+ 3 (count label))]
|
||||
|
||||
@@ -27,12 +27,11 @@
|
||||
#{:script :base :head :link :meta :style :title :comment :xml :svg :frame :frameset :embed :object :canvas :applet})
|
||||
|
||||
(defn ^:large-vars/cleanup-todo hiccup->doc-inner
|
||||
[format hiccup opts]
|
||||
(let [transform-fn (fn [hiccup opts]
|
||||
(hiccup->doc-inner format hiccup opts))
|
||||
block-pattern (if (= format :markdown)
|
||||
"#"
|
||||
(config/get-block-pattern format))
|
||||
[hiccup opts]
|
||||
(let [format :markdown
|
||||
transform-fn (fn [hiccup opts]
|
||||
(hiccup->doc-inner hiccup opts))
|
||||
block-pattern "#"
|
||||
map-join (fn [children & {list?' :list?}]
|
||||
(let [opts' (if list?'
|
||||
(let [level (inc (or (:level opts) 0))]
|
||||
@@ -142,20 +141,14 @@
|
||||
(when-not (string/blank? href)
|
||||
(if has-img-tag?
|
||||
(export-hiccup x)
|
||||
(case format
|
||||
:markdown (util/format "[%s](%s)" label href)
|
||||
:org (util/format "[[%s][%s]]" href label)
|
||||
nil))))
|
||||
(util/format "[%s](%s)" label href))))
|
||||
:img (let [src (:src attrs)
|
||||
alt (or (:alt attrs) "")
|
||||
;; reject url-encoded and utf8-encoded(svg)
|
||||
unsafe-data-url? (and (string/starts-with? src "data:")
|
||||
(not (re-find #"^data:.*?;base64," src)))]
|
||||
(when-not unsafe-data-url?
|
||||
(case format
|
||||
:markdown (util/format "" alt src)
|
||||
:org (util/format "[[%s][%s]]" src alt)
|
||||
nil)))
|
||||
(util/format "" alt src)))
|
||||
:p (util/format "%s"
|
||||
(map-join children))
|
||||
|
||||
@@ -186,25 +179,17 @@
|
||||
(reset! *inside-pre? true)
|
||||
(let [content (string/trim (doall (map-join children)))]
|
||||
(reset! *inside-pre? false)
|
||||
(case format
|
||||
:markdown (if (util/starts-with? content "```")
|
||||
content
|
||||
(str "```\n" content "\n```"))
|
||||
:org (if (util/starts-with? content "#+BEGIN_SRC")
|
||||
content
|
||||
(util/format "#+BEGIN_SRC\n%s\n#+END_SRC" content))
|
||||
nil)))
|
||||
(if (util/starts-with? content "```")
|
||||
content
|
||||
(str "```\n" content "\n```"))))
|
||||
|
||||
:blockquote
|
||||
(case format
|
||||
:markdown (str "> " (map-join children))
|
||||
:org (util/format "#+BEGIN_QUOTE\n%s\n#+END_QUOTE" (map-join children))
|
||||
nil)
|
||||
(str "> " (map-join children))
|
||||
|
||||
:li
|
||||
(let [tabs (apply str (repeat (- (or (:level opts) 1) 1) "\t"))]
|
||||
(str tabs
|
||||
(if (= format :markdown) "-" "*")
|
||||
"-"
|
||||
" "
|
||||
(map-join children)))
|
||||
|
||||
@@ -212,32 +197,18 @@
|
||||
"\n"
|
||||
|
||||
:dt
|
||||
(case format
|
||||
:org (str "- " (map-join children) " ")
|
||||
:markdown (str (map-join children) "\n")
|
||||
nil)
|
||||
(str (map-join children) "\n")
|
||||
|
||||
:dd
|
||||
(case format
|
||||
:markdown (str ": " (map-join children) "\n")
|
||||
:org (str ":: " (map-join children) "\n")
|
||||
nil)
|
||||
(str ": " (map-join children) "\n")
|
||||
|
||||
:thead
|
||||
(case format
|
||||
:markdown (let [columns (count (last (first children)))]
|
||||
(str
|
||||
(map-join children)
|
||||
(str "| " (string/join " | "
|
||||
(repeat columns "----"))
|
||||
" |")))
|
||||
:org (let [columns (count (last (first children)))]
|
||||
(str
|
||||
(map-join children)
|
||||
(str "|" (string/join "+"
|
||||
(repeat columns "----"))
|
||||
"|")))
|
||||
nil)
|
||||
(let [columns (count (last (first children)))]
|
||||
(str
|
||||
(map-join children)
|
||||
(str "| " (string/join " | "
|
||||
(repeat columns "----"))
|
||||
" |")))
|
||||
:tr
|
||||
(str "| "
|
||||
(->> (map #(transform-fn % (assoc opts :in-table? true)) children)
|
||||
@@ -265,8 +236,8 @@
|
||||
(apply str result)))
|
||||
|
||||
(defn hiccup->doc
|
||||
[format hiccup]
|
||||
(let [s (hiccup->doc-inner format hiccup {})]
|
||||
[hiccup]
|
||||
(let [s (hiccup->doc-inner hiccup {})]
|
||||
(if (string/blank? s)
|
||||
""
|
||||
(-> s
|
||||
@@ -287,11 +258,11 @@
|
||||
s))
|
||||
|
||||
(defn convert
|
||||
[format html]
|
||||
[html]
|
||||
(when-not (string/blank? html)
|
||||
(let [hiccup (hickory/as-hiccup (hickory/parse html))
|
||||
decoded-hiccup (html-decode-hiccup hiccup)
|
||||
result (hiccup->doc format decoded-hiccup)]
|
||||
result (hiccup->doc decoded-hiccup)]
|
||||
(remove-ending-dash-lines result))))
|
||||
|
||||
(comment
|
||||
|
||||
@@ -1,33 +1,19 @@
|
||||
(ns frontend.format
|
||||
"Main ns for providing common operations on file content like conversion to html
|
||||
and edn. Can handle org-mode and markdown formats"
|
||||
(:require [frontend.format.mldoc :refer [->MldocMode] :as mldoc]
|
||||
"Main ns for providing common operations on markdown file content like conversion to html
|
||||
and edn"
|
||||
(:require [clojure.string :as string]
|
||||
[frontend.format.mldoc :refer [->MldocMode] :as mldoc]
|
||||
[frontend.format.protocol :as protocol]
|
||||
[logseq.graph-parser.mldoc :as gp-mldoc]
|
||||
[logseq.common.util :as common-util]
|
||||
[clojure.string :as string]))
|
||||
[logseq.graph-parser.mldoc :as gp-mldoc]))
|
||||
|
||||
(defonce mldoc-record (->MldocMode))
|
||||
|
||||
(defn get-format-record
|
||||
[format]
|
||||
(case (common-util/normalize-format format)
|
||||
:org
|
||||
mldoc-record
|
||||
:markdown
|
||||
mldoc-record
|
||||
nil))
|
||||
|
||||
(defn to-html
|
||||
[content format config]
|
||||
[content config]
|
||||
(if (string/blank? content)
|
||||
""
|
||||
(if-let [record (get-format-record format)]
|
||||
(protocol/toHtml record content config gp-mldoc/default-references)
|
||||
content)))
|
||||
(protocol/toHtml mldoc-record content config gp-mldoc/default-references)))
|
||||
|
||||
(defn to-edn
|
||||
[content format config]
|
||||
(if-let [record (get-format-record format)]
|
||||
(protocol/toEdn record content config)
|
||||
nil))
|
||||
[content config]
|
||||
(protocol/toEdn mldoc-record content config))
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
(:require [cljs.cache :as cache]
|
||||
[clojure.string :as string]
|
||||
[frontend.common.cache :as common.cache]
|
||||
[frontend.config :as config]
|
||||
[frontend.db :as db]
|
||||
[frontend.format :as format]
|
||||
[frontend.format.mldoc :as mldoc]
|
||||
@@ -13,7 +12,8 @@
|
||||
[frontend.state :as state]
|
||||
[lambdaisland.glogi :as log]
|
||||
[logseq.graph-parser.block :as gp-block]
|
||||
[logseq.graph-parser.property :as gp-property]))
|
||||
[logseq.graph-parser.property :as gp-property]
|
||||
[logseq.common.config :as common-config]))
|
||||
|
||||
(defn extract-blocks
|
||||
"Wrapper around logseq.graph-parser.block/extract-blocks that adds in system state
|
||||
@@ -23,7 +23,7 @@ and handles unexpected failure."
|
||||
(try
|
||||
(let [blocks (gp-block/extract-blocks blocks content format
|
||||
{:user-config (state/get-config)
|
||||
:block-pattern (config/get-block-pattern format)
|
||||
:block-pattern common-config/block-pattern
|
||||
:db (db/get-db repo)
|
||||
:date-formatter (state/get-date-formatter)
|
||||
:page-name page-name
|
||||
@@ -53,7 +53,7 @@ and handles unexpected failure."
|
||||
;; it enabled yet and can cause visible bugs when '#' is used
|
||||
blocks (if (:logseq.property.node/display-type block)
|
||||
[block]
|
||||
(let [ast (format/to-edn title format parse-config)]
|
||||
(let [ast (format/to-edn title parse-config)]
|
||||
(extract-blocks ast title format {})))
|
||||
new-block (first blocks)
|
||||
block (cond-> (merge block new-block)
|
||||
@@ -67,9 +67,9 @@ and handles unexpected failure."
|
||||
(defonce *blocks-ast-cache (volatile! (cache/lru-cache-factory {} :threshold 5000)))
|
||||
|
||||
(defn- parse-title-and-body-helper
|
||||
[format content]
|
||||
(let [parse-config (mldoc/get-default-config format)
|
||||
ast (->> (format/to-edn content format parse-config)
|
||||
[_format content]
|
||||
(let [parse-config (mldoc/get-default-config :markdown)
|
||||
ast (->> (format/to-edn content parse-config)
|
||||
(map first))
|
||||
title (when (gp-block/heading-block? (first ast))
|
||||
(:title (second (first ast))))
|
||||
@@ -96,7 +96,7 @@ and handles unexpected failure."
|
||||
(:block/title block)))))
|
||||
([_block-uuid format content]
|
||||
(when-not (string/blank? content)
|
||||
(let [content (str (config/get-block-pattern format) " " (string/triml content))]
|
||||
(let [content (str common-config/block-pattern " " (string/triml content))]
|
||||
(cached-parse-title-and-body-helper format content)))))
|
||||
|
||||
(defn break-line-paragraph?
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
"DB-based graph implementation"
|
||||
(:require [clojure.string :as string]
|
||||
[frontend.commands :as commands]
|
||||
[frontend.config :as config]
|
||||
[frontend.db :as db]
|
||||
[frontend.format.block :as block]
|
||||
[frontend.format.mldoc :as mldoc]
|
||||
@@ -16,7 +15,8 @@
|
||||
[frontend.util :as util]
|
||||
[logseq.db.frontend.content :as db-content]
|
||||
[logseq.outliner.op]
|
||||
[promesa.core :as p]))
|
||||
[promesa.core :as p]
|
||||
[logseq.common.config :as common-config]))
|
||||
|
||||
(defn- remove-non-existed-refs!
|
||||
[refs]
|
||||
@@ -54,7 +54,7 @@
|
||||
(let [ast (mldoc/->edn (string/trim title) :markdown)
|
||||
first-elem-type (first (ffirst ast))
|
||||
block-with-title? (mldoc/block-with-title? first-elem-type)
|
||||
content' (str (config/get-block-pattern :markdown) (if block-with-title? " " "\n") title)
|
||||
content' (str common-config/block-pattern (if block-with-title? " " "\n") title)
|
||||
parsed-block (block/parse-block (assoc block :block/title content'))
|
||||
block' (-> (merge block parsed-block {:block/title title})
|
||||
(dissoc :block/format))]
|
||||
|
||||
@@ -1645,7 +1645,6 @@
|
||||
label (or label "")]
|
||||
(case (keyword format)
|
||||
:markdown (util/format "[%s](%s)" label link)
|
||||
:org (util/format "[[%s][%s]]" link label)
|
||||
nil)))
|
||||
|
||||
(defn- get-image-link
|
||||
@@ -1653,8 +1652,7 @@
|
||||
(let [link (or link "")
|
||||
label (or label "")]
|
||||
(case (keyword format)
|
||||
:markdown (util/format "" label link)
|
||||
:org (util/format "[[%s]]"))))
|
||||
:markdown (util/format "" label link))))
|
||||
|
||||
(defn handle-command-input-close [id]
|
||||
(state/set-editor-show-input! nil)
|
||||
|
||||
@@ -48,11 +48,9 @@
|
||||
(string/join "\n"
|
||||
(mapv (fn [p] (->> (string/trim p)
|
||||
((fn [p]
|
||||
(if (util/safe-re-find (if (= format :org)
|
||||
#"\s*\*+\s+"
|
||||
#"\s*-\s+") p)
|
||||
(if (util/safe-re-find #"\s*-\s+" p)
|
||||
p
|
||||
(str (if (= format :org) "* " "- ") p))))))
|
||||
(str "- " p))))))
|
||||
paragraphs))]
|
||||
(paste-text-parseable format updated-paragraphs)))
|
||||
|
||||
@@ -81,15 +79,13 @@
|
||||
|
||||
(defn- selection-within-link?
|
||||
[selection-and-format]
|
||||
(let [{:keys [format selection-start selection-end selection value]} selection-and-format]
|
||||
(let [{:keys [selection-start selection-end selection value]} selection-and-format]
|
||||
(and (not= selection-start selection-end)
|
||||
(->> (case format
|
||||
:markdown (util/re-pos #"\[.*?\]\(.*?\)" value)
|
||||
:org (util/re-pos #"\[\[.*?\]\[.*?\]\]" value))
|
||||
(->> (util/re-pos #"\[.*?\]\(.*?\)" value)
|
||||
(some (fn [[start-index matched-text]]
|
||||
(and (<= start-index selection-start)
|
||||
(>= (+ start-index (count matched-text)) selection-end)
|
||||
(clojure.string/includes? matched-text selection))))
|
||||
(string/includes? matched-text selection))))
|
||||
some?))))
|
||||
|
||||
;; See https://developer.chrome.com/blog/web-custom-formats-for-the-async-clipboard-api/
|
||||
@@ -112,10 +108,6 @@
|
||||
[text]
|
||||
(boolean (util/safe-re-find #"(?m)^\s*(?:[-+*]|#+)\s+" text)))
|
||||
|
||||
(defn- org-blocks?
|
||||
[text]
|
||||
(boolean (util/safe-re-find #"(?m)^\s*\*+\s+" text)))
|
||||
|
||||
(defn- get-revert-cut-txs
|
||||
"Get reverted previous cut tx when paste"
|
||||
[blocks]
|
||||
@@ -165,17 +157,16 @@
|
||||
(let [format (or (db/get-page-format (state/get-current-page)) :markdown)
|
||||
html-text (let [result (when-not (string/blank? html)
|
||||
(try
|
||||
(html-parser/convert format html)
|
||||
(html-parser/convert html)
|
||||
(catch :default e
|
||||
(log/error :exception e)
|
||||
nil)))]
|
||||
(if (string/blank? result) nil result))
|
||||
text-blocks? (if (= format :markdown) markdown-blocks? org-blocks?)
|
||||
text' (or html-text
|
||||
(when (common-util/url? text)
|
||||
(wrap-macro-url text))
|
||||
text)
|
||||
blocks? (text-blocks? text')]
|
||||
blocks? (markdown-blocks? text')]
|
||||
(cond
|
||||
blocks?
|
||||
(paste-text-parseable format text')
|
||||
|
||||
@@ -552,7 +552,7 @@
|
||||
(string/replace matched link (util/node-path.join url link))
|
||||
matched)))
|
||||
content)]
|
||||
(format/to-html content :markdown (gp-mldoc/default-config :markdown))))
|
||||
(format/to-html content (gp-mldoc/default-config :markdown))))
|
||||
(catch :default e
|
||||
(log/error :parse-user-md-exception e)
|
||||
content)))
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
[logseq.db :as ldb]
|
||||
[logseq.graph-parser.text :as text]
|
||||
[logseq.shui.ui :as shui]
|
||||
[reitit.frontend.easy :as rfe]))
|
||||
[reitit.frontend.easy :as rfe]
|
||||
[logseq.common.config :as common-config]))
|
||||
|
||||
(defn redirect!
|
||||
"If `push` is truthy, previous page will be left in history."
|
||||
@@ -128,8 +129,8 @@
|
||||
block-title (when (and block? (not page))
|
||||
(when-let [block (db/entity [:block/uuid (uuid name)])]
|
||||
(let [content (text/remove-level-spaces (:block/title block)
|
||||
(get block :block/format :markdown)
|
||||
(config/get-block-pattern (get block :block/format :markdown)))]
|
||||
:markdown
|
||||
common-config/block-pattern)]
|
||||
(if (> (count content) 48)
|
||||
(str (subs content 0 48) "...")
|
||||
content))))
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
[clojure.string :as string]
|
||||
[frontend.config :as config]
|
||||
[frontend.date :as date]
|
||||
[frontend.db :as db]
|
||||
[frontend.handler.editor :as editor-handler]
|
||||
[frontend.handler.notification :as notification]
|
||||
[frontend.handler.page :as page-handler]
|
||||
@@ -53,7 +52,6 @@
|
||||
(if (state/enable-journals?) ;; default to "quick capture" page if journals are not enabled
|
||||
today-page
|
||||
"quick capture"))
|
||||
format (db/get-page-format page)
|
||||
time (date/get-current-time)
|
||||
text (or (and content (not-empty (string/trim content))) "")
|
||||
link (cond
|
||||
@@ -67,10 +65,10 @@
|
||||
(util/format "{{twitter %s}}" url)
|
||||
|
||||
(= title url)
|
||||
(config/link-format format nil url)
|
||||
(config/link-format nil url)
|
||||
|
||||
:else
|
||||
(config/link-format format title url))
|
||||
(config/link-format title url))
|
||||
template (get-in (state/get-config)
|
||||
[:quick-capture-templates :text]
|
||||
"**{time}** [[quick capture]]: {text} {url}")
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
[frontend.search.protocol :as protocol]
|
||||
[frontend.state :as state]
|
||||
[frontend.util :as util]
|
||||
[logseq.common.config :as common-config]
|
||||
[promesa.core :as p]))
|
||||
|
||||
(def fuzzy-search fuzzy/fuzzy-search)
|
||||
@@ -32,7 +31,7 @@
|
||||
(when-let [repo (state/get-current-repo)]
|
||||
(let [q (fuzzy/clean-str q)]
|
||||
(when-not (string/blank? q)
|
||||
(p/let [mldoc-exts (set (map name common-config/mldoc-support-formats))
|
||||
(p/let [mldoc-exts #{"markdown" "md"}
|
||||
result (db-async/<get-files repo)
|
||||
files (->> result
|
||||
(map first)
|
||||
|
||||
@@ -248,7 +248,6 @@
|
||||
:help/forum-community "Fòrum de la comunitat"
|
||||
:help/markdown-syntax "Sintaxi de Markdown"
|
||||
:help/open-link-in-sidebar "Obrir enllaç al panell lateral"
|
||||
:help/org-mode-syntax "Sintaxi del mode Org"
|
||||
:help/privacy "Política de privacitat"
|
||||
:help/reference-autocomplete "Referència de pàgina"
|
||||
:help/roadmap "Full de ruta"
|
||||
|
||||
@@ -469,7 +469,6 @@
|
||||
:help/awesome-logseq "Úžasný Logseq"
|
||||
:help/blog "Logseq blog"
|
||||
:help/markdown-syntax "Markdown syntaxe"
|
||||
:help/org-mode-syntax "Org mode syntaxe"
|
||||
:linked-references/filter-directions "Kliknutím na tlačítko zahrnete a kliknutím s klávesou Shift vyloučíte. Dalším kliknutím odstraníte."
|
||||
:linked-references/filter-excludes "Nezahrnuje: "
|
||||
:linked-references/filter-heading "Filtruje"
|
||||
|
||||
@@ -145,7 +145,6 @@
|
||||
:help/forum-community "Forum"
|
||||
:help/markdown-syntax "Syntax von Markdown"
|
||||
:help/open-link-in-sidebar "Link in Seitenleiste öffnen"
|
||||
:help/org-mode-syntax "Syntax von Org-mode"
|
||||
:help/privacy "Datenschutzrichtlinie"
|
||||
:help/reference-autocomplete "Seitenverweis Autovervollständigung"
|
||||
:help/search "Suche Seiten/Blöcke/Befehle"
|
||||
|
||||
@@ -65,7 +65,6 @@
|
||||
:search-item/no-result "No matched result"
|
||||
:help/context-menu "Block context menu"
|
||||
:help/markdown-syntax "Markdown syntax"
|
||||
:help/org-mode-syntax "Org mode syntax"
|
||||
:bold "Bold"
|
||||
:italics "Italics"
|
||||
:highlight "Highlight"
|
||||
|
||||
@@ -247,7 +247,6 @@
|
||||
:help/forum-community "Foro de la comunidad"
|
||||
:help/markdown-syntax "Sintaxis de Markdown"
|
||||
:help/open-link-in-sidebar "Abrir enlace en barra lateral"
|
||||
:help/org-mode-syntax "Sintaxis del modo Org"
|
||||
:help/privacy "Política de privacidad"
|
||||
:help/reference-autocomplete "Referencia de página"
|
||||
:help/roadmap "Hoja de ruta"
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
:search-item/no-result "نتایجی یافت نشد"
|
||||
:help/context-menu "فهرست زمینهای بلوک"
|
||||
:help/markdown-syntax "نحو مارکداون"
|
||||
:help/org-mode-syntax "نحو حالت Org"
|
||||
:bold "ضخیم"
|
||||
:italics "کج"
|
||||
:strikethrough "خطزده"
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
:help/open-link-in-sidebar "Ouvrir le lien dans la barre latérale"
|
||||
:help/context-menu "Menu contextuel"
|
||||
:help/markdown-syntax "Syntaxe Markdown"
|
||||
:help/org-mode-syntax "Syntaxe Org mode"
|
||||
:bold "Gras"
|
||||
:italics "Italique"
|
||||
:highlight "Surligner"
|
||||
|
||||
@@ -55,7 +55,6 @@
|
||||
:search-item/no-result "Tidak ada hasil yang cocok"
|
||||
:help/context-menu "Blokir menu konteks"
|
||||
:help/markdown-syntax "Sintaks penurunan harga"
|
||||
:help/org-mode-syntax "Sintaks mode org"
|
||||
:bold "Cetak tebal"
|
||||
:italics "Cetak miring"
|
||||
:highlight "Sorot"
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
:help/open-link-in-sidebar "Apri il link nel pannello laterale"
|
||||
:help/context-menu "Menù contestuale del blocco"
|
||||
:help/markdown-syntax "Sintassi Markdown"
|
||||
:help/org-mode-syntax "Sintassi Org mode"
|
||||
:bold "Grassetto"
|
||||
:italics "Corsivo"
|
||||
:highlight "Evidenzia"
|
||||
|
||||
@@ -64,7 +64,6 @@
|
||||
:search-item/no-result "一致する結果がありません"
|
||||
:help/context-menu "ブロックのコンテキストメニュー"
|
||||
:help/markdown-syntax "マークダウン文法"
|
||||
:help/org-mode-syntax "Org mode 文法"
|
||||
:bold "太字"
|
||||
:italics "斜体"
|
||||
:highlight "ハイライト"
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
:help/open-link-in-sidebar "사이드바에서 링크 열기"
|
||||
:help/context-menu "블록 컨텍스트 메뉴"
|
||||
:help/markdown-syntax "Markdown 문법"
|
||||
:help/org-mode-syntax "Org mode 문법"
|
||||
:bold "볼드체"
|
||||
:italics "이탤릭체"
|
||||
:highlight "하이라이트"
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
:help/open-link-in-sidebar "Åpne lenke i sidestolpe"
|
||||
:help/context-menu "Kontekstmeny"
|
||||
:help/markdown-syntax "Markdown syntaks"
|
||||
:help/org-mode-syntax "Org mode syntaks"
|
||||
:bold "Fet"
|
||||
:italics "Kursiv"
|
||||
:highlight "Markering"
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
:help/open-link-in-sidebar "Otwórz link w panelu bocznym"
|
||||
:help/context-menu "Menu kontekstowe bloku"
|
||||
:help/markdown-syntax "Składnia Markdown"
|
||||
:help/org-mode-syntax "Składnia Org mode"
|
||||
:bold "Pogrubienie"
|
||||
:italics "Pochylenie"
|
||||
:highlight "Wyróżnij"
|
||||
|
||||
@@ -64,7 +64,6 @@
|
||||
:search-item/no-result "Nenhum resultado correspondente"
|
||||
:help/context-menu "Bloquear menu de contexto"
|
||||
:help/markdown-syntax "Sintaxe de Markdown"
|
||||
:help/org-mode-syntax "Sintaxe de Org mode"
|
||||
:bold "Negrito"
|
||||
:italics "Itálico"
|
||||
:highlight "Destaque"
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
:search-item/page "Página"
|
||||
:help/context-menu "Menu de contexto"
|
||||
:help/markdown-syntax "Sintaxe de Markdown"
|
||||
:help/org-mode-syntax "Sintaxe do modo Org"
|
||||
:bold "Negrito"
|
||||
:italics "Itálico"
|
||||
:highlight "Realçado"
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
:search-item/page "Страница"
|
||||
:help/context-menu "Контекстное меню блока"
|
||||
:help/markdown-syntax "Markdown синтаксис"
|
||||
:help/org-mode-syntax "Org-mode синтаксис"
|
||||
:bold "Жирный"
|
||||
:italics "Курсив"
|
||||
:highlight "Выделение"
|
||||
|
||||
@@ -64,7 +64,6 @@
|
||||
:search-item/no-result "Eşleşen sonuç yok"
|
||||
:help/context-menu "Blok kısayol menüsü"
|
||||
:help/markdown-syntax "Markdown sözdizimi"
|
||||
:help/org-mode-syntax "Org modu sözdizimi"
|
||||
:bold "Kalın"
|
||||
:italics "İtalik"
|
||||
:highlight "Vurgulu"
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
:search-item/page "Сторінка"
|
||||
:help/context-menu "Контекстне меню блоку"
|
||||
:help/markdown-syntax "Синтаксис Markdown"
|
||||
:help/org-mode-syntax "Синтаксис Org-режиму"
|
||||
:bold "Жирний"
|
||||
:italics "Курсив"
|
||||
:highlight "Виділення"
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
:search-item/no-result "未找到匹配项"
|
||||
:help/context-menu "右键菜单"
|
||||
:help/markdown-syntax "Markdown 语法"
|
||||
:help/org-mode-syntax "Org Mode 语法"
|
||||
:bold "粗体"
|
||||
:italics "斜体"
|
||||
:highlight "高亮"
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
:search-item/page "頁面"
|
||||
:help/context-menu "區塊內容選單"
|
||||
:help/markdown-syntax "Markdown 格式"
|
||||
:help/org-mode-syntax "Org-mode 格式"
|
||||
:bold "粗體"
|
||||
:italics "斜體"
|
||||
:highlight "高亮"
|
||||
|
||||
@@ -20,17 +20,4 @@
|
||||
|
||||
"<b>bold</b> <i>italic</i> <mark>mark</mark>"
|
||||
"**bold** *italic* ==mark=="))
|
||||
|
||||
(testing "org mode"
|
||||
(are [x y] (= (parser/convert :org x) y)
|
||||
"<ul><li>a</li><ul><li>b</li></ul></ul>"
|
||||
"* a\n\n\t* b"
|
||||
|
||||
"<ul><li>a</li><li>b</li></ul>"
|
||||
"* a\n* b"
|
||||
|
||||
"<ul><li>a</li><li>b</li><ol><li>c</li><dl>d</dl></ol></ul>"
|
||||
"* a\n* b\n\n\t* c\n\nd"
|
||||
|
||||
"<b>bold</b> <i>italic</i> <mark>mark</mark>"
|
||||
"*bold* /italic/ ^^mark^^")))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user