mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-31 05:48:49 +01:00
⚡ Support for saving .sy files in the single-line format https://github.com/siyuan-note/siyuan/issues/8712
This commit is contained in:
parent
eb65bb4ec0
commit
9eeee3965a
13 changed files with 55 additions and 22 deletions
|
|
@ -185,6 +185,7 @@ func InitConf() {
|
|||
Conf.FileTree.DocCreateSavePath = strings.TrimSuffix(Conf.FileTree.DocCreateSavePath, "/")
|
||||
Conf.FileTree.DocCreateSavePath = strings.TrimSpace(Conf.FileTree.DocCreateSavePath)
|
||||
}
|
||||
util.UseSingleLineSave = Conf.FileTree.UseSingleLineSave
|
||||
|
||||
util.CurrentCloudRegion = Conf.CloudRegion
|
||||
|
||||
|
|
|
|||
|
|
@ -190,12 +190,14 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {
|
|||
renderer := render.NewJSONRenderer(tree, luteEngine.RenderOptions)
|
||||
data := renderer.Render()
|
||||
|
||||
buf := bytes.Buffer{}
|
||||
buf.Grow(4096)
|
||||
if err = json.Indent(&buf, data, "", "\t"); nil != err {
|
||||
return
|
||||
if !util.UseSingleLineSave {
|
||||
buf := bytes.Buffer{}
|
||||
buf.Grow(1024 * 1024 * 2)
|
||||
if err = json.Indent(&buf, data, "", "\t"); nil != err {
|
||||
return
|
||||
}
|
||||
data = buf.Bytes()
|
||||
}
|
||||
data = buf.Bytes()
|
||||
|
||||
if err = os.WriteFile(syPath, data, 0644); nil != err {
|
||||
logging.LogErrorf("write .sy [%s] failed: %s", syPath, err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue