浏览代码

fix: add page embeds to page references

Tienson Qin 4 年之前
父节点
当前提交
2df3fd297d
共有 4 个文件被更改,包括 10 次插入11 次删除
  1. 1 1
      package.json
  2. 5 5
      src/main/frontend/format/block.cljs
  3. 0 1
      src/main/frontend/handler/export.cljs
  4. 4 4
      yarn.lock

+ 1 - 1
package.json

@@ -72,7 +72,7 @@
         "gulp-cached": "^1.1.1",
         "ignore": "^5.1.8",
         "jszip": "^3.5.0",
-        "mldoc": "0.5.4",
+        "mldoc": "0.5.5",
         "mousetrap": "^1.6.5",
         "path": "^0.12.7",
         "react": "^17.0.1",

+ 5 - 5
src/main/frontend/format/block.cljs

@@ -60,11 +60,11 @@
                (and (vector? block)
                     (= "Macro" (first block)))
                (let [{:keys [name arguments]} (second block)]
-                 (when (and (= name "embed")
-                            (string? (first arguments))
-                            (string/starts-with? (first arguments) "[[")
-                            (string/ends-with? (first arguments) "]]"))
-                   (subs (first arguments) 2 (- (count (first arguments)) 2))))
+                 (let [argument (string/join ", " arguments)]
+                   (when (and (= name "embed")
+                              (string? argument)
+                              (text/page-ref? argument))
+                     (text/page-ref-un-brackets! argument))))
                :else
                nil)]
     (when (and

+ 0 - 1
src/main/frontend/handler/export.cljs

@@ -199,7 +199,6 @@
     {:embed_blocks embed-blocks
      :embed_pages pages-name-and-content}))
 
-
 (defn export-repo-as-markdown!
   [repo]
   (when-let [repo (state/get-current-repo)]

+ 4 - 4
yarn.lock

@@ -3846,10 +3846,10 @@ mkdirp@^0.5.4, mkdirp@~0.5.1:
   dependencies:
     minimist "^1.2.5"
 
[email protected].4:
-  version "0.5.4"
-  resolved "https://registry.yarnpkg.com/mldoc/-/mldoc-0.5.4.tgz#3157d2bbd200567a8e5dc9cc9b54ce81c57466c1"
-  integrity sha512-lNDaxF/ysVML28WYaM3xMA+VDmSURI3CUgyM5p5qwZ+PphFQtgF4+e86sPV7uc1gGE2wRenQZ8F0U9IP1TQNpQ==
[email protected].5:
+  version "0.5.5"
+  resolved "https://registry.yarnpkg.com/mldoc/-/mldoc-0.5.5.tgz#cb7eea471adc94e1c7858d4ae772ddabe0a75753"
+  integrity sha512-acseZvvwzLNlvp6/fZzqP5rqS80keWOK1XCreem5eXJNxLtJm+xIqzEJVcsmeyFS1Leya1gPT7dMcCUOhEr26g==
   dependencies:
     yargs "^12.0.2"