diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p.sy index 840745644d6..61b7ffd3b9b 100644 --- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p.sy +++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p.sy @@ -8,9 +8,55 @@ "title": "Please Start Here", "title-img": "background-color:#556;background-image: linear-gradient(30deg, #445 12%, transparent 12.5%, transparent 87%, #445 87.5%, #445),linear-gradient(150deg, #445 12%, transparent 12.5%, transparent 87%, #445 87.5%, #445),linear-gradient(30deg, #445 12%, transparent 12.5%, transparent 87%, #445 87.5%, #445),linear-gradient(150deg, #445 12%, transparent 12.5%, transparent 87%, #445 87.5%, #445),linear-gradient(60deg, #99a 25%, transparent 25.5%, transparent 75%, #99a 75%, #99a),linear-gradient(60deg, #99a 25%, transparent 25.5%, transparent 75%, #99a 75%, #99a);background-size:80px 140px;background-position: 0 0, 0 0, 40px 70px, 40px 70px, 0 0, 40px 70px;", "type": "doc", - "updated": "20241018102340" + "updated": "20241125224626" }, "Children": [ + { + "ID": "20241125224615-dwfqru1", + "Type": "NodeBlockquote", + "Properties": { + "id": "20241125224615-dwfqru1", + "updated": "20241125224626" + }, + "Children": [ + { + "Type": "NodeBlockquoteMarker", + "Data": "\u003e" + }, + { + "ID": "20241125224615-z2fevdf", + "Type": "NodeParagraph", + "Properties": { + "id": "20241125224615-z2fevdf", + "updated": "20241125224626" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "When you close SiYuan Notes, the User Guide will be automatically closed. You can click " + }, + { + "Type": "NodeTextMark", + "TextMarkType": "kbd", + "TextMarkTextContent": "Main Menu" + }, + { + "Type": "NodeText", + "Data": " - " + }, + { + "Type": "NodeTextMark", + "TextMarkType": "kbd", + "TextMarkTextContent": "User Guide" + }, + { + "Type": "NodeText", + "Data": " to view it again" + } + ] + } + ] + }, { "ID": "20210528120135-bznvpp6", "Type": "NodeSuperBlock", diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa.sy index 9aa3f090cec..57fc4a8b397 100644 --- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa.sy +++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa.sy @@ -8,9 +8,55 @@ "title": "请从这里开始", "title-img": "background-color:#556;background-image: linear-gradient(30deg, #445 12%, transparent 12.5%, transparent 87%, #445 87.5%, #445),linear-gradient(150deg, #445 12%, transparent 12.5%, transparent 87%, #445 87.5%, #445),linear-gradient(30deg, #445 12%, transparent 12.5%, transparent 87%, #445 87.5%, #445),linear-gradient(150deg, #445 12%, transparent 12.5%, transparent 87%, #445 87.5%, #445),linear-gradient(60deg, #99a 25%, transparent 25.5%, transparent 75%, #99a 75%, #99a),linear-gradient(60deg, #99a 25%, transparent 25.5%, transparent 75%, #99a 75%, #99a);background-size:80px 140px;background-position: 0 0, 0 0, 40px 70px, 40px 70px, 0 0, 40px 70px;", "type": "doc", - "updated": "20241018102134" + "updated": "20241125224159" }, "Children": [ + { + "ID": "20241125224159-8zf3bos", + "Type": "NodeBlockquote", + "Properties": { + "id": "20241125224159-8zf3bos", + "updated": "20241125224159" + }, + "Children": [ + { + "Type": "NodeBlockquoteMarker", + "Data": "\u003e" + }, + { + "ID": "20241125224159-vcaj2bv", + "Type": "NodeParagraph", + "Properties": { + "id": "20241125224159-vcaj2bv", + "updated": "20241125224159" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "关闭思源笔记时会自动关闭用户指南,可以点击 " + }, + { + "Type": "NodeTextMark", + "TextMarkType": "kbd", + "TextMarkTextContent": "主菜单" + }, + { + "Type": "NodeText", + "Data": " - " + }, + { + "Type": "NodeTextMark", + "TextMarkType": "kbd", + "TextMarkTextContent": "用户指南" + }, + { + "Type": "NodeText", + "Data": " 再次查看" + } + ] + } + ] + }, { "ID": "20210528115012-vst5lwt", "Type": "NodeSuperBlock", diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq.sy index 6ca66e5ac8d..28867e0b87b 100644 --- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq.sy +++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq.sy @@ -8,9 +8,55 @@ "title": "請從這裡開始", "title-img": "background-color:#556;background-image: linear-gradient(30deg, #445 12%, transparent 12.5%, transparent 87%, #445 87.5%, #445),linear-gradient(150deg, #445 12%, transparent 12.5%, transparent 87%, #445 87.5%, #445),linear-gradient(30deg, #445 12%, transparent 12.5%, transparent 87%, #445 87.5%, #445),linear-gradient(150deg, #445 12%, transparent 12.5%, transparent 87%, #445 87.5%, #445),linear-gradient(60deg, #99a 25%, transparent 25.5%, transparent 75%, #99a 75%, #99a),linear-gradient(60deg, #99a 25%, transparent 25.5%, transparent 75%, #99a 75%, #99a);background-size:80px 140px;background-position: 0 0, 0 0, 40px 70px, 40px 70px, 0 0, 40px 70px;", "type": "doc", - "updated": "20241018105300" + "updated": "20241125224503" }, "Children": [ + { + "ID": "20241125224503-8vqkbc9", + "Type": "NodeBlockquote", + "Properties": { + "id": "20241125224503-8vqkbc9", + "updated": "20241125224503" + }, + "Children": [ + { + "Type": "NodeBlockquoteMarker", + "Data": "\u003e" + }, + { + "ID": "20241125224503-fqq0875", + "Type": "NodeParagraph", + "Properties": { + "id": "20241125224503-fqq0875", + "updated": "20241125224503" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "關閉思源筆記時會自動關閉用戶指南,可以點擊 " + }, + { + "Type": "NodeTextMark", + "TextMarkType": "kbd", + "TextMarkTextContent": "主菜單" + }, + { + "Type": "NodeText", + "Data": " - " + }, + { + "Type": "NodeTextMark", + "TextMarkType": "kbd", + "TextMarkTextContent": "用戶指南" + }, + { + "Type": "NodeText", + "Data": " ​再次查看" + } + ] + } + ] + }, { "ID": "20211226115745-rorv31l", "Type": "NodeSuperBlock", diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx.sy index 935918798b0..219e9f7e219 100644 --- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx.sy +++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx.sy @@ -9,9 +9,55 @@ "title": "スタートガイド", "title-img": "background-color:#556;background-image: linear-gradient(30deg, #445 12%, transparent 12.5%, transparent 87%, #445 87.5%, #445),linear-gradient(150deg, #445 12%, transparent 12.5%, transparent 87%, #445 87.5%, #445),linear-gradient(30deg, #445 12%, transparent 12.5%, transparent 87%, #445 87.5%, #445),linear-gradient(150deg, #445 12%, transparent 12.5%, transparent 87%, #445 87.5%, #445),linear-gradient(60deg, #99a 25%, transparent 25.5%, transparent 75%, #99a 75%, #99a),linear-gradient(60deg, #99a 25%, transparent 25.5%, transparent 75%, #99a 75%, #99a);background-size:80px 140px;background-position: 0 0, 0 0, 40px 70px, 40px 70px, 0 0, 40px 70px;", "type": "doc", - "updated": "20241018102426" + "updated": "20241125225136" }, "Children": [ + { + "ID": "20241125224702-5a9o34q", + "Type": "NodeBlockquote", + "Properties": { + "id": "20241125224702-5a9o34q", + "updated": "20241125225136" + }, + "Children": [ + { + "Type": "NodeBlockquoteMarker", + "Data": "\u003e" + }, + { + "ID": "20241125225100-s0akx3f", + "Type": "NodeParagraph", + "Properties": { + "id": "20241125225100-s0akx3f", + "updated": "20241125225136" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "SiYuan を閉じると、ユーザーガイドは自動的に閉じられます。" + }, + { + "Type": "NodeTextMark", + "TextMarkType": "kbd", + "TextMarkTextContent": "メインメニュー" + }, + { + "Type": "NodeText", + "Data": " - " + }, + { + "Type": "NodeTextMark", + "TextMarkType": "kbd", + "TextMarkTextContent": "ユーザーガイド" + }, + { + "Type": "NodeText", + "Data": " ​をクリックすると、再度表示できます" + } + ] + } + ] + }, { "ID": "20240530101000-x3xk6o7", "Type": "NodeSuperBlock", diff --git a/app/stage/service-worker.js b/app/stage/service-worker.js index c7c2626c53c..34b3c8f38fc 100644 --- a/app/stage/service-worker.js +++ b/app/stage/service-worker.js @@ -6,7 +6,7 @@ const INITIAL_CACHED_RESOURCES = [ "/stage/icon-large.png", "/stage/icon.png", "/stage/loading-pure.svg", - "/stage/build/fonts/JetBrainsMono-Regular.woff", + "/stage/build/fonts/JetBrainsMono-Regular.woff2", "/stage/protyle/js/lute/lute.min.js", "/stage/protyle/js/protyle-html.js" ]; diff --git a/app/webpack.config.js b/app/webpack.config.js index 1a78e14dce9..f6d7632141a 100644 --- a/app/webpack.config.js +++ b/app/webpack.config.js @@ -76,10 +76,10 @@ module.exports = (env, argv) => { ], }, { - test: /\.woff$/, + test: /\.woff2$/, type: "asset/resource", generator: { - filename: "../fonts/JetBrainsMono-Regular.woff", + filename: "../fonts/JetBrainsMono-Regular.woff2", }, }, { diff --git a/app/webpack.desktop.js b/app/webpack.desktop.js index 9d29ed83c9f..66cfe7de860 100644 --- a/app/webpack.desktop.js +++ b/app/webpack.desktop.js @@ -79,10 +79,10 @@ module.exports = (env, argv) => { ], }, { - test: /\.woff$/, + test: /\.woff2$/, type: "asset/resource", generator: { - filename: "../fonts/JetBrainsMono-Regular.woff", + filename: "../fonts/JetBrainsMono-Regular.woff2", }, }, { diff --git a/app/webpack.export.js b/app/webpack.export.js index 019e6b743fd..da74154f075 100644 --- a/app/webpack.export.js +++ b/app/webpack.export.js @@ -72,10 +72,10 @@ module.exports = (env, argv) => { ], }, { - test: /\.woff$/, + test: /\.woff2$/, type: "asset/resource", generator: { - filename: "../fonts/JetBrainsMono-Regular.woff", + filename: "../fonts/JetBrainsMono-Regular.woff2", }, }, ], diff --git a/app/webpack.mobile.js b/app/webpack.mobile.js index 858c723e32f..3c3665e2631 100644 --- a/app/webpack.mobile.js +++ b/app/webpack.mobile.js @@ -80,10 +80,10 @@ module.exports = (env, argv) => { ], }, { - test: /\.woff$/, + test: /\.woff2$/, type: "asset/resource", generator: { - filename: "../fonts/JetBrainsMono-Regular.woff", + filename: "../fonts/JetBrainsMono-Regular.woff2", }, }, { diff --git a/kernel/model/backlink.go b/kernel/model/backlink.go index 97941b374cf..09417921bb2 100644 --- a/kernel/model/backlink.go +++ b/kernel/model/backlink.go @@ -614,11 +614,7 @@ func matchBacklinkKeyword(block *Block, keywords []string) bool { for _, k := range keywords { k = strings.ToLower(k) - content := block.Content - if block.IsContainerBlock() { - content = block.FContent - } - if strings.Contains(strings.ToLower(content), k) || + if strings.Contains(strings.ToLower(block.Content), k) || strings.Contains(strings.ToLower(path.Base(block.HPath)), k) || strings.Contains(strings.ToLower(block.Name), k) || strings.Contains(strings.ToLower(block.Alias), k) || diff --git a/kernel/model/export.go b/kernel/model/export.go index f0fba8e5d0c..127e2ab1f36 100644 --- a/kernel/model/export.go +++ b/kernel/model/export.go @@ -1944,6 +1944,8 @@ func exportMarkdownContent0(tree *parse.Tree, cloudAssetsBase string, assetsDest }) } + currentDocDir := path.Dir(tree.HPath) + var unlinks []*ast.Node ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus { if !entering { @@ -1979,11 +1981,17 @@ func exportMarkdownContent0(tree *parse.Tree, cloudAssetsBase string, assetsDest var href string bt := treenode.GetBlockTree(defID) if nil != bt { - href += strings.TrimPrefix(bt.HPath, "/") + ".md" + href += bt.HPath + ".md" if "d" != bt.Type { href += "#" + defID } + if tree.ID == bt.RootID { + href = "#" + defID + } } + href = strings.TrimPrefix(href, currentDocDir) + href = util.FilterFilePath(href) + href = strings.TrimPrefix(href, "/") blockRefLink := &ast.Node{Type: ast.NodeTextMark, TextMarkType: "a", TextMarkTextContent: linkText, TextMarkAHref: href} blockRefLink.KramdownIAL = n.KramdownIAL n.InsertBefore(blockRefLink) diff --git a/kernel/util/file.go b/kernel/util/file.go index 1d33101031c..619e6e3364a 100644 --- a/kernel/util/file.go +++ b/kernel/util/file.go @@ -231,16 +231,16 @@ func FilterFilePath(p string) (ret string) { } func FilterFileName(name string) string { - name = strings.ReplaceAll(name, "\\", "") - name = strings.ReplaceAll(name, "/", "") - name = strings.ReplaceAll(name, ":", "") - name = strings.ReplaceAll(name, "*", "") - name = strings.ReplaceAll(name, "?", "") - name = strings.ReplaceAll(name, "\"", "") - name = strings.ReplaceAll(name, "'", "") - name = strings.ReplaceAll(name, "<", "") - name = strings.ReplaceAll(name, ">", "") - name = strings.ReplaceAll(name, "|", "") + name = strings.ReplaceAll(name, "\\", "_") + name = strings.ReplaceAll(name, "/", "_") + name = strings.ReplaceAll(name, ":", "_") + name = strings.ReplaceAll(name, "*", "_") + name = strings.ReplaceAll(name, "?", "_") + name = strings.ReplaceAll(name, "\"", "_") + name = strings.ReplaceAll(name, "'", "_") + name = strings.ReplaceAll(name, "<", "_") + name = strings.ReplaceAll(name, ">", "_") + name = strings.ReplaceAll(name, "|", "_") name = strings.TrimSpace(name) name = gulu.Str.RemoveInvisible(name) // Remove invisible characters from file names when uploading assets https://github.com/siyuan-note/siyuan/issues/11683 return name