Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2023-06-17 16:22:30 +08:00
commit 4097117342
21 changed files with 74 additions and 93 deletions

View file

@ -239,7 +239,7 @@ For more details, please refer to [Development Guide](https://github.com/siyuan-
* If it is installed through the installation package on the desktop, you can open the option of <kbd>Settings</kbd> - <kbd>About</kbd> - <kbd>Automatically download update installation package</kbd>, so that SiYuan will automatically download The latest version of the installation package and prompts to install
* If it is installed by manual installation package, please download the installation package again to install
You can <kbd>Check update</kbd> in <kbd>Settings</kbd> - <kbd>About</kbd> - <kbd>Current Version</kbd>, or by following [GitHub Releases](https://github.com/siyuan-note/siyuan/releases) or [SiYuan Announcement](https://ld246.com/tag/siyuan-announcement) to get the new version.
You can <kbd>Check update</kbd> in <kbd>Settings</kbd> - <kbd>About</kbd> - <kbd>Current Version</kbd>, or by following [GitHub Releases](https://github.com/siyuan-note/siyuan/releases) to get the new version.
**Note**: Do not place the workspace in the installation directory, because the updated version will clear all files in the installation directory

View file

@ -100,11 +100,10 @@
[![Star History Chart](https://api.star-history.com/svg?repos=siyuan-note/siyuan&type=Date)](https://star-history.com/#siyuan-note/siyuan&Date)
## 🗺️ 路线图
* [思源笔记开发计划和进度](https://github.com/orgs/siyuan-note/projects/1)
* [思源笔记版本变更和公告](https://ld246.com/tag/siyuan-announcement)
* [思源笔记版本变更和公告](CHANGELOG.md)
## 🚀 下载安装
@ -243,7 +242,7 @@
* 如果是桌面端通过安装包安装的,可打开 <kbd>设置</kbd> - <kbd>关于</kbd> - <kbd>自动下载更新安装包</kbd> 选项,这样思源会自动下载最新版安装包并提示安装
* 如果是通过手动安装包安装的,请再次下载安装包安装
可在 <kbd>设置</kbd> - <kbd>关于</kbd> - <kbd>当前版本</kbd><kbd>检查更新</kbd>,也可以通过关注 [GitHub Releases](https://github.com/siyuan-note/siyuan/releases) 或者[思源笔记公告](https://ld246.com/tag/siyuan-announcement)来获取新版本。
可在 <kbd>设置</kbd> - <kbd>关于</kbd> - <kbd>当前版本</kbd><kbd>检查更新</kbd>,也可以通过关注 [GitHub Releases](https://github.com/siyuan-note/siyuan/releases) 来获取新版本。
**注意**:切勿将工作空间放置于安装目录下,因为更新版本会清空安装目录下的所有文件

View file

@ -843,7 +843,7 @@
"about17": "Do not enable proxy when set to <code class='fn__code'>Direct connection</code>",
"checkUpdate": "Check update",
"currentVer": "Current version",
"visitAnnouncements": "<a href=\"https://github.com/siyuan-note/siyuan/releases\" target=\"_blank\">View system announcements</a>",
"visitAnnouncements": "<a href=\"https://github.com/siyuan-note/siyuan/releases\" target=\"_blank\">Visit all published versions</a>",
"themeLight": "Light",
"themeDark": "Dark",
"themeOS": "Follow the system",

View file

@ -843,7 +843,7 @@
"about17": "No habilite el proxy cuando esté configurado como <code class='fn__code'>Conexión directa</code>",
"checkUpdate": "Comprobar actualización",
"currentVer": "Versión actual",
"visitAnnouncements": "<a href=\"https://github.com/siyuan-note/siyuan/releases\" target=\"_blank\">Ver los anuncios del sistema</a>",
"visitAnnouncements": "<a href=\"https://github.com/siyuan-note/siyuan/releases\" target=\"_blank\">Visita todas las versiones publicadas</a>",
"themeLight": "Claro",
"themeDark": "Oscuro",
"themeOS": "Sigue el sistema",

View file

@ -843,7 +843,7 @@
"about17": "N'activez pas le proxy lorsqu'il est défini sur <code class='fn__code'>Connexion directe</code>.",
"checkUpdate": "Vérifier la mise à jour",
"currentVer": "Version actuelle",
"visitAnnouncements": "<a href=\"https://github.com/siyuan-note/siyuan/releases\" target=\"_blank\">Voir les annonces du système</a>",
"visitAnnouncements": "<a href=\"https://github.com/siyuan-note/siyuan/releases\" target=\"_blank\">Visitez toutes les versions publiées</a>",
"themeLight": "Clair",
"themeDark": "Sombre",
"themeOS": "Suivre le système",

View file

@ -843,7 +843,7 @@
"about17": "設置為 <code class='fn__code'>直接連接</code> 時不啟用代理",
"checkUpdate": "檢查更新",
"currentVer": "當前版本",
"visitAnnouncements": "<a href=\"https://ld246.com/tag/siyuan-announcement\" target=\"_blank\">瀏覽系統公告</a>",
"visitAnnouncements": "<a href=\"https://github.com/siyuan-note/siyuan/releases\" target=\"_blank\">瀏覽所有已發布的版本</a>",
"themeLight": "淺色",
"themeDark": "深色",
"themeOS": "跟隨系統",

View file

@ -843,7 +843,7 @@
"about17": "设置为 <code class='fn__code'>直接连接</code> 时不启用代理",
"checkUpdate": "检查更新",
"currentVer": "当前版本",
"visitAnnouncements": "<a href=\"https://ld246.com/tag/siyuan-announcement\" target=\"_blank\">浏览系统公告</a>",
"visitAnnouncements": "<a href=\"https://github.com/siyuan-note/siyuan/releases\" target=\"_blank\">浏览所有已发布的版本</a>",
"themeLight": "明亮",
"themeDark": "暗黑",
"themeOS": "跟随系统",

View file

@ -7,7 +7,7 @@
"id": "20200923234731-h3zkwm2",
"title": "FAQ",
"type": "doc",
"updated": "20230512170538"
"updated": "20230617085510"
},
"Children": [
{
@ -1080,7 +1080,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20220909100946-9eyc3uh",
"updated": "20220909101124"
"updated": "20230617085510"
},
"Children": [
{
@ -1094,7 +1094,7 @@
},
{
"Type": "NodeText",
"Data": " in "
"Data": " in "
},
{
"Type": "NodeTextMark",
@ -1103,7 +1103,7 @@
},
{
"Type": "NodeText",
"Data": " - "
"Data": " - "
},
{
"Type": "NodeTextMark",
@ -1112,7 +1112,7 @@
},
{
"Type": "NodeText",
"Data": " - "
"Data": " - "
},
{
"Type": "NodeTextMark",
@ -1121,7 +1121,7 @@
},
{
"Type": "NodeText",
"Data": ", or by following "
"Data": ", or by following "
},
{
"Type": "NodeTextMark",
@ -1129,16 +1129,6 @@
"TextMarkAHref": "https ://github.com/siyuan-note/siyuan/releases",
"TextMarkTextContent": "GitHub Releases"
},
{
"Type": "NodeText",
"Data": " or "
},
{
"Type": "NodeTextMark",
"TextMarkType": "a",
"TextMarkAHref": "https://ld246.com/tag/siyuan-announcement",
"TextMarkTextContent": "SiYuan Announcement"
},
{
"Type": "NodeText",
"Data": " to get the new version."

View file

@ -7,7 +7,7 @@
"id": "20200813093015-u6bopdt",
"title": "常见问题",
"type": "doc",
"updated": "20230406111909"
"updated": "20230617085407"
},
"Children": [
{
@ -1080,7 +1080,8 @@
"ID": "20220909100742-liorixq",
"Type": "NodeParagraph",
"Properties": {
"id": "20220909100742-liorixq"
"id": "20220909100742-liorixq",
"updated": "20230617085407"
},
"Children": [
{
@ -1094,7 +1095,7 @@
},
{
"Type": "NodeText",
"Data": " - "
"Data": " - "
},
{
"Type": "NodeTextMark",
@ -1103,7 +1104,7 @@
},
{
"Type": "NodeText",
"Data": " - "
"Data": " - "
},
{
"Type": "NodeTextMark",
@ -1112,7 +1113,7 @@
},
{
"Type": "NodeText",
"Data": " 中 "
"Data": " 中 "
},
{
"Type": "NodeTextMark",
@ -1121,7 +1122,7 @@
},
{
"Type": "NodeText",
"Data": ",也可以通过关注 "
"Data": ",也可以通过关注 "
},
{
"Type": "NodeTextMark",
@ -1131,17 +1132,7 @@
},
{
"Type": "NodeText",
"Data": " 或者"
},
{
"Type": "NodeTextMark",
"TextMarkType": "a",
"TextMarkAHref": "https://ld246.com/tag/siyuan-announcement",
"TextMarkTextContent": "思源笔记公告"
},
{
"Type": "NodeText",
"Data": "来获取新版本。"
"Data": " 来获取新版本。"
}
]
},

View file

@ -6,7 +6,7 @@
"icon": "1f6e3",
"id": "20230519105228-hm0y74i",
"title": "最新进展",
"updated": "20230519112131"
"updated": "20230617085456"
},
"Children": [
{
@ -59,7 +59,7 @@
"ListData": {},
"Properties": {
"id": "20230519110202-1k238kq",
"updated": "20230519112131"
"updated": "20230617085456"
},
"Children": [
{
@ -287,7 +287,7 @@
},
"Properties": {
"id": "20230519111239-83o3a2y",
"updated": "20230519111248"
"updated": "20230617085456"
},
"Children": [
{
@ -295,7 +295,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20230519111239-2guijgg",
"updated": "20230519111248"
"updated": "20230617085456"
},
"Children": [
{
@ -305,8 +305,8 @@
{
"Type": "NodeTextMark",
"TextMarkType": "a",
"TextMarkAHref": "https://ld246.com/tag/siyuan-announcement",
"TextMarkTextContent": "https://ld246.com/tag/siyuan-announcement"
"TextMarkAHref": "https://ld246.com/tag/siyuan",
"TextMarkTextContent": "https://ld246.com/tag/siyuan"
}
]
}

View file

@ -6,7 +6,7 @@
"icon": "2753",
"id": "20211226115227-r1rty9v",
"title": "常見問題",
"updated": "20230512170521"
"updated": "20230617085423"
},
"Children": [
{
@ -1073,7 +1073,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20220909100912-rvyxrtl",
"updated": "20220909100912"
"updated": "20230617085423"
},
"Children": [
{
@ -1087,7 +1087,7 @@
},
{
"Type": "NodeText",
"Data": " - "
"Data": " - "
},
{
"Type": "NodeTextMark",
@ -1096,7 +1096,7 @@
},
{
"Type": "NodeText",
"Data": " - "
"Data": " - "
},
{
"Type": "NodeTextMark",
@ -1105,7 +1105,7 @@
},
{
"Type": "NodeText",
"Data": " 中 "
"Data": " 中 "
},
{
"Type": "NodeTextMark",
@ -1114,7 +1114,7 @@
},
{
"Type": "NodeText",
"Data": ",也可以通過關注 "
"Data": ",也可以通過關注 "
},
{
"Type": "NodeTextMark",
@ -1124,17 +1124,7 @@
},
{
"Type": "NodeText",
"Data": " 或者"
},
{
"Type": "NodeTextMark",
"TextMarkType": "a",
"TextMarkAHref": "https://ld246.com/tag/siyuan-announcement",
"TextMarkTextContent": "思源筆記公告"
},
{
"Type": "NodeText",
"Data": "來獲取新版本。"
"Data": " 來獲取新版本。"
}
]
},

File diff suppressed because one or more lines are too long

View file

@ -498,9 +498,10 @@ func exportPreview(c *gin.Context) {
}
id := arg["id"].(string)
stdHTML := model.Preview(id)
stdHTML, outline := model.Preview(id)
ret.Data = map[string]interface{}{
"html": stdHTML,
"html": stdHTML,
"outline": outline,
}
}

View file

@ -6,7 +6,7 @@ require (
github.com/88250/clipboard v0.1.5
github.com/88250/css v0.1.2
github.com/88250/gulu v1.2.3-0.20230615033005-b519d6875346
github.com/88250/lute v1.7.6-0.20230608014232-e10343eb445d
github.com/88250/lute v1.7.6-0.20230617074457-ffab89d50887
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
github.com/ClarkThan/ahocorasick v0.0.0-20230220142845-f237b6348b3e

View file

@ -8,8 +8,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5 h1:8HdZozCsXS
github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/88250/gulu v1.2.3-0.20230615033005-b519d6875346 h1:U0wZN6zuf+vUhzdHC6DbZE/bY5FUt3FuCwn/KgObV44=
github.com/88250/gulu v1.2.3-0.20230615033005-b519d6875346/go.mod h1:pTWnjt+6qUqNnP9xltswsJxgCBVu3C7eW09u48LWX0k=
github.com/88250/lute v1.7.6-0.20230608014232-e10343eb445d h1:D3HPp3lcibUYqq6hu/dPP6rx+To23VyE96eMBhwFoNg=
github.com/88250/lute v1.7.6-0.20230608014232-e10343eb445d/go.mod h1:+wUqx/1kdFDbWtxn9LYJlaCOAeol2pjSO6w+WJTVQsg=
github.com/88250/lute v1.7.6-0.20230617074457-ffab89d50887 h1:jIOA18lMo4DOdF3K66lu4DCOhgrfeHTNY710cXuPkL0=
github.com/88250/lute v1.7.6-0.20230617074457-ffab89d50887/go.mod h1:+wUqx/1kdFDbWtxn9LYJlaCOAeol2pjSO6w+WJTVQsg=
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c h1:Dl/8S9iLyPMTElnWIBxmjaLiWrkI5P4a21ivwAn5pU0=
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c/go.mod h1:S5YT38L/GCjVjmB4PB84PymA1qfopjEhfhTNQilLpv4=
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=

View file

@ -103,7 +103,7 @@ func NetImg2LocalAssets(rootID, originalURL string) (err error) {
// `网络图片转换为本地图片` 支持处理 `file://` 本地路径图片 https://github.com/siyuan-note/siyuan/issues/6546
u := string(dest)[7:]
if !gulu.File.IsExist(u) {
if !gulu.File.IsExist(u) || gulu.File.IsDir(u) {
return ast.WalkSkipChildren
}

View file

@ -252,7 +252,7 @@ func GetBacklink2(id, keyword, mentionKeyword string, sortMode, mentionSortMode
refs = removeDuplicatedRefs(refs) // 同一个块中引用多个相同块时反链去重 https://github.com/siyuan-note/siyuan/issues/3317
linkRefs, linkRefsCount, excludeBacklinkIDs := buildLinkRefs(rootID, refs, keyword)
tmpBacklinks := toFlatTree(linkRefs, 0, "backlink")
tmpBacklinks := toFlatTree(linkRefs, 0, "backlink", nil)
for _, l := range tmpBacklinks {
l.Blocks = nil
@ -282,7 +282,7 @@ func GetBacklink2(id, keyword, mentionKeyword string, sortMode, mentionSortMode
})
mentionRefs, _ := buildTreeBackmention(sqlBlock, linkRefs, mentionKeyword, excludeBacklinkIDs, 12)
tmpBackmentions := toFlatTree(mentionRefs, 0, "backlink")
tmpBackmentions := toFlatTree(mentionRefs, 0, "backlink", nil)
for _, l := range tmpBackmentions {
l.Blocks = nil
backmentions = append(backmentions, l)
@ -442,7 +442,7 @@ func GetBacklink(id, keyword, mentionKeyword string, beforeLen int) (boxID strin
mentions, _ := buildTreeBackmention(sqlBlock, linkRefs, mentionKeyword, excludeBacklinkIDs, beforeLen)
mentionsCount = len(mentions)
mentionPaths = toFlatTree(mentions, 0, "backlink")
mentionPaths = toFlatTree(mentions, 0, "backlink", nil)
return
}

View file

@ -272,7 +272,8 @@ func ExportData() (zipPath string, err error) {
util.PushEndlessProgress(Conf.Language(65))
defer util.ClearPushProgress(100)
exportFolder := filepath.Join(util.TempDir, "export", util.CurrentTimeSecondsStr())
name := util.FilterFileName(filepath.Base(util.WorkspaceDir)) + "-" + util.CurrentTimeSecondsStr()
exportFolder := filepath.Join(util.TempDir, "export", name)
zipPath, err = exportData(exportFolder)
if nil != err {
return
@ -317,7 +318,7 @@ func exportData(exportFolder string) (zipPath string, err error) {
return
}
func Preview(id string) string {
func Preview(id string) (retStdHTML string, retOutline []*Path) {
tree, _ := loadTreeByBlockID(id)
tree = exportTree(tree, false, false, false,
Conf.Export.BlockRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode,
@ -328,7 +329,13 @@ func Preview(id string) string {
luteEngine.SetFootnotes(true)
md := treenode.FormatNode(tree.Root, luteEngine)
tree = parse.Parse("", []byte(md), luteEngine.ParseOptions)
return luteEngine.ProtylePreview(tree, luteEngine.RenderOptions)
retStdHTML = luteEngine.ProtylePreview(tree, luteEngine.RenderOptions)
if footnotesDefBlock := tree.Root.ChildByType(ast.NodeFootnotesDefBlock); nil != footnotesDefBlock {
footnotesDefBlock.Unlink()
}
retOutline = outline(tree)
return
}
func ExportDocx(id, savePath string, removeAssets, merge bool) (err error) {

View file

@ -20,6 +20,7 @@ import (
"time"
"github.com/88250/lute/ast"
"github.com/88250/lute/parse"
"github.com/emirpasic/gods/stacks/linkedliststack"
"github.com/siyuan-note/siyuan/kernel/treenode"
"github.com/siyuan-note/siyuan/kernel/util"
@ -35,13 +36,18 @@ func Outline(rootID string) (ret []*Path, err error) {
return
}
ret = outline(tree)
return
}
func outline(tree *parse.Tree) (ret []*Path) {
luteEngine := NewLute()
var headings []*Block
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
if entering && ast.NodeHeading == n.Type && !n.ParentIs(ast.NodeBlockquote) {
n.Box, n.Path = tree.Box, tree.Path
block := &Block{
RootID: rootID,
RootID: tree.Root.ID,
Depth: n.HeadingLevel,
Box: n.Box,
Path: n.Path,
@ -82,7 +88,7 @@ func Outline(rootID string) (ret []*Path, err error) {
}
}
ret = toFlatTree(blocks, 0, "outline")
ret = toFlatTree(blocks, 0, "outline", tree)
if 0 < len(ret) {
children := ret[0].Blocks
ret = nil

View file

@ -25,6 +25,7 @@ import (
"strings"
"github.com/88250/lute/ast"
"github.com/88250/lute/parse"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/search"
"github.com/siyuan-note/siyuan/kernel/sql"
@ -99,12 +100,12 @@ func createDocsByHPath(boxID, hPath, content, parentID string) (id string, exist
return
}
func toFlatTree(blocks []*Block, baseDepth int, typ string) (ret []*Path) {
func toFlatTree(blocks []*Block, baseDepth int, typ string, tree *parse.Tree) (ret []*Path) {
var blockRoots []*Block
for _, block := range blocks {
root := getBlockIn(blockRoots, block.RootID)
if nil == root {
root, _ = getBlock(block.RootID, nil)
root, _ = getBlock(block.RootID, tree)
blockRoots = append(blockRoots, root)
}
if nil == root {

View file

@ -196,34 +196,30 @@ func initWorkspaceDir(workspaceArg string) {
defaultWorkspaceDir = filepath.Join(userProfile, "Documents", "SiYuan")
}
}
if err := os.MkdirAll(defaultWorkspaceDir, 0755); nil != err && !os.IsExist(err) {
logging.LogErrorf("create default workspace folder [%s] failed: %s", defaultWorkspaceDir, err)
os.Exit(logging.ExitCodeInitWorkspaceErr)
}
var workspacePaths []string
if !gulu.File.IsExist(workspaceConf) {
WorkspaceDir = defaultWorkspaceDir
if "" != workspaceArg {
WorkspaceDir = workspaceArg
}
} else {
workspacePaths, _ = ReadWorkspacePaths()
if 0 < len(workspacePaths) {
// 取最后一个(也就是最近打开的)工作空间
WorkspaceDir = workspacePaths[len(workspacePaths)-1]
} else {
WorkspaceDir = defaultWorkspaceDir
}
}
if "" != workspaceArg {
WorkspaceDir = workspaceArg
}
if "" != workspaceArg {
WorkspaceDir = workspaceArg
}
if !gulu.File.IsDir(WorkspaceDir) {
logging.LogWarnf("use the default workspace [%s] since the specified workspace [%s] is not a dir", WorkspaceDir, defaultWorkspaceDir)
if err := os.MkdirAll(defaultWorkspaceDir, 0755); nil != err && !os.IsExist(err) {
logging.LogErrorf("create default workspace folder [%s] failed: %s", defaultWorkspaceDir, err)
os.Exit(logging.ExitCodeInitWorkspaceErr)
}
WorkspaceDir = defaultWorkspaceDir
}
workspacePaths = append(workspacePaths, WorkspaceDir)