From 10df855457cc45da35144bdd5596445188370eae Mon Sep 17 00:00:00 2001 From: Jeffrey Chen <78434827+TCOTC@users.noreply.github.com> Date: Thu, 19 Jun 2025 10:32:04 +0800 Subject: [PATCH 1/4] :art: Improve Liandi clipping (#15087) * :bug: Improve Liandi clipping fix https://github.com/siyuan-note/siyuan/issues/15086 * :bug: Improve Liandi clipping fix https://github.com/siyuan-note/siyuan/issues/15086 --- kernel/api/extension.go | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/kernel/api/extension.go b/kernel/api/extension.go index fe24cf494..97fa3e3cd 100644 --- a/kernel/api/extension.go +++ b/kernel/api/extension.go @@ -62,13 +62,32 @@ func extensionCopy(c *gin.Context) { clippingSym := false symArticleHref := "" - if nil != form.Value["href"] { + + hasHref := nil != form.Value["href"] + isPartClip := nil != form.Value["clipType"] && form.Value["clipType"][0] == "part" + + if hasHref && !isPartClip { // 剪藏链滴帖子时直接使用 Markdown 接口的返回 // https://ld246.com/article/raw/1724850322251 symArticleHref = form.Value["href"][0] - if strings.HasPrefix(symArticleHref, "https://ld246.com/article/") || strings.HasPrefix(symArticleHref, "https://liuyun.io/article/") { - symArticleHref = strings.ReplaceAll(symArticleHref, "https://ld246.com/article/", "https://ld246.com/article/raw/") - symArticleHref = strings.ReplaceAll(symArticleHref, "https://liuyun.io/article/", "https://liuyun.io/article/raw/") + + var baseURL, originalPrefix string + if strings.HasPrefix(symArticleHref, "https://ld246.com/article/") { + baseURL = "https://ld246.com/article/raw/" + originalPrefix = "https://ld246.com/article/" + } else if strings.HasPrefix(symArticleHref, "https://liuyun.io/article/") { + baseURL = "https://liuyun.io/article/raw/" + originalPrefix = "https://liuyun.io/article/" + } + + if "" != baseURL { + articleID := strings.TrimPrefix(symArticleHref, originalPrefix) + + if idx := strings.IndexAny(articleID, "/?#"); -1 != idx { + articleID = articleID[:idx] + } + + symArticleHref = baseURL + articleID clippingSym = true } } From f0d49acdeacd6f830acfd34685cc1dfd15b04aa0 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 18 Jun 2025 16:31:28 +0800 Subject: [PATCH 2/4] :recycle: Upgrade to Electron v36.5.0 https://github.com/siyuan-note/siyuan/issues/15022 --- .github/CONTRIBUTING.md | 6 +++--- .github/CONTRIBUTING_zh_CN.md | 6 +++--- app/pnpm-lock.yaml | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 14e1ede3f..6aef9f34f 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -14,10 +14,10 @@ Install pnpm: `npm install -g pnpm@10.12.1` Set the Electron mirror environment variable and install Electron: -* macOS/Linux: `ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ pnpm install electron@v36.4.0 -D` +* macOS/Linux: `ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ pnpm install electron@v36.5.0 -D` * Windows: * `SET ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/` - * `pnpm install electron@v36.4.0 -D` + * `pnpm install electron@v36.5.0 -D` NPM mirror: @@ -27,7 +27,7 @@ NPM mirror: Enter the app folder and execute: -* `pnpm install electron@v36.4.0 -D` +* `pnpm install electron@v36.5.0 -D` * `pnpm run dev` * `pnpm run start` diff --git a/.github/CONTRIBUTING_zh_CN.md b/.github/CONTRIBUTING_zh_CN.md index 940253da7..7d019dfed 100644 --- a/.github/CONTRIBUTING_zh_CN.md +++ b/.github/CONTRIBUTING_zh_CN.md @@ -14,10 +14,10 @@ 设置 Electron 镜像环境变量并安装 Electron: -* macOS/Linux:`ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ pnpm install electron@v36.4.0 -D` +* macOS/Linux:`ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ pnpm install electron@v36.5.0 -D` * Windows: * `SET ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/` - * `pnpm install electron@v36.4.0 -D` + * `pnpm install electron@v36.5.0 -D` NPM 镜像: @@ -27,7 +27,7 @@ NPM 镜像: 进入 app 文件夹执行: -* `pnpm install electron@v36.4.0 -D` +* `pnpm install electron@v36.5.0 -D` * `pnpm run dev` * `pnpm run start` diff --git a/app/pnpm-lock.yaml b/app/pnpm-lock.yaml index 58ff6b8a8..80e29e3f8 100644 --- a/app/pnpm-lock.yaml +++ b/app/pnpm-lock.yaml @@ -131,8 +131,8 @@ packages: resolution: {integrity: sha512-Qkzpg2s9GnVV2I2BjRksUi43U5e6+zaQMcjoJy0C+C5oxaKl+fmckGDQFtRpZpZV0NQekuZZ+tGz7EA9TVnQtQ==} engines: {node: '>=12'} - '@electron/node-gyp@git+https://github.com/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2': - resolution: {commit: 06b29aafb7708acef8b3669835c8a7857ebc92d2, repo: https://github.com/electron/node-gyp.git, type: git} + '@electron/node-gyp@https://codeload.github.com/electron/node-gyp/tar.gz/06b29aafb7708acef8b3669835c8a7857ebc92d2': + resolution: {tarball: https://codeload.github.com/electron/node-gyp/tar.gz/06b29aafb7708acef8b3669835c8a7857ebc92d2} version: 10.2.0-electron.1 engines: {node: '>=12.13.0'} hasBin: true @@ -2803,7 +2803,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@electron/node-gyp@git+https://github.com/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2': + '@electron/node-gyp@https://codeload.github.com/electron/node-gyp/tar.gz/06b29aafb7708acef8b3669835c8a7857ebc92d2': dependencies: env-paths: 2.2.1 exponential-backoff: 3.1.2 @@ -2840,7 +2840,7 @@ snapshots: '@electron/rebuild@3.7.0': dependencies: - '@electron/node-gyp': git+https://github.com/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2 + '@electron/node-gyp': https://codeload.github.com/electron/node-gyp/tar.gz/06b29aafb7708acef8b3669835c8a7857ebc92d2 '@malept/cross-spawn-promise': 2.0.0 chalk: 4.1.2 debug: 4.4.0 From 13e618075b61c6a7207f98b68f52e024837125f3 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Thu, 19 Jun 2025 10:35:32 +0800 Subject: [PATCH 3/4] :art: Clean code https://github.com/siyuan-note/siyuan/pull/15087 --- kernel/api/extension.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/kernel/api/extension.go b/kernel/api/extension.go index 97fa3e3cd..d249bb73b 100644 --- a/kernel/api/extension.go +++ b/kernel/api/extension.go @@ -62,10 +62,8 @@ func extensionCopy(c *gin.Context) { clippingSym := false symArticleHref := "" - hasHref := nil != form.Value["href"] isPartClip := nil != form.Value["clipType"] && form.Value["clipType"][0] == "part" - if hasHref && !isPartClip { // 剪藏链滴帖子时直接使用 Markdown 接口的返回 // https://ld246.com/article/raw/1724850322251 @@ -82,7 +80,6 @@ func extensionCopy(c *gin.Context) { if "" != baseURL { articleID := strings.TrimPrefix(symArticleHref, originalPrefix) - if idx := strings.IndexAny(articleID, "/?#"); -1 != idx { articleID = articleID[:idx] } From b466792276bd49e38ea9a4030876b334c9315551 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Thu, 19 Jun 2025 10:46:31 +0800 Subject: [PATCH 4/4] :art: Ignore the last empty paragraph block when exporting merged sub-documents https://github.com/siyuan-note/siyuan/issues/15028 --- kernel/model/export_merge.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/model/export_merge.go b/kernel/model/export_merge.go index b0058600e..7b660f26f 100644 --- a/kernel/model/export_merge.go +++ b/kernel/model/export_merge.go @@ -60,6 +60,12 @@ func mergeSubDocs(rootTree *parse.Tree) (ret *parse.Tree, err error) { break } } + + if ast.NodeParagraph == insertPoint.Type && nil == insertPoint.FirstChild { + // 删除空段落 + // Ignore the last empty paragraph block when exporting merged sub-documents https://github.com/siyuan-note/siyuan/issues/15028 + insertPoint.Unlink() + } return }