mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
🎨 Improve the handling of inline-math containing | in the table https://github.com/siyuan-note/siyuan/issues/9227
This commit is contained in:
parent
859a541155
commit
734114e052
8 changed files with 34 additions and 13 deletions
6
app/stage/protyle/js/lute/lute.min.js
vendored
6
app/stage/protyle/js/lute/lute.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -128,7 +128,7 @@ func html2BlockDOM(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 复制带超链接的图片无法保存到本地 https://github.com/siyuan-note/siyuan/issues/5993
|
// 复制带超链接的图片无法保存到本地 https://github.com/siyuan-note/siyuan/issues/5993
|
||||||
parse.NestedInlines2FlattedSpans(tree)
|
parse.NestedInlines2FlattedSpans(tree, false)
|
||||||
|
|
||||||
renderer := render.NewProtyleRenderer(tree, luteEngine.RenderOptions)
|
renderer := render.NewProtyleRenderer(tree, luteEngine.RenderOptions)
|
||||||
output := renderer.Render()
|
output := renderer.Render()
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ func ParseJSON(jsonData []byte, options *parse.Options) (ret *parse.Tree, needFi
|
||||||
}
|
}
|
||||||
|
|
||||||
if needMigrate2Spec1 {
|
if needMigrate2Spec1 {
|
||||||
parse.NestedInlines2FlattedSpans(ret)
|
parse.NestedInlines2FlattedSpans(ret, false)
|
||||||
needFix = true
|
needFix = true
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ func prepareWriteTree(tree *parse.Tree) (data []byte, filePath string, err error
|
||||||
|
|
||||||
filePath = filepath.Join(util.DataDir, tree.Box, tree.Path)
|
filePath = filepath.Join(util.DataDir, tree.Box, tree.Path)
|
||||||
if oldSpec := tree.Root.Spec; "" == oldSpec {
|
if oldSpec := tree.Root.Spec; "" == oldSpec {
|
||||||
parse.NestedInlines2FlattedSpans(tree)
|
parse.NestedInlines2FlattedSpans(tree, false)
|
||||||
tree.Root.Spec = "1"
|
tree.Root.Spec = "1"
|
||||||
logging.LogInfof("migrated tree [%s] from spec [%s] to [%s]", filePath, oldSpec, tree.Root.Spec)
|
logging.LogInfof("migrated tree [%s] from spec [%s] to [%s]", filePath, oldSpec, tree.Root.Spec)
|
||||||
}
|
}
|
||||||
|
|
@ -199,7 +199,7 @@ func parseJSON2Tree(boxID, p string, jsonData []byte, luteEngine *lute.Lute) (re
|
||||||
|
|
||||||
filePath := filepath.Join(util.DataDir, ret.Box, ret.Path)
|
filePath := filepath.Join(util.DataDir, ret.Box, ret.Path)
|
||||||
if oldSpec := ret.Root.Spec; "" == oldSpec {
|
if oldSpec := ret.Root.Spec; "" == oldSpec {
|
||||||
parse.NestedInlines2FlattedSpans(ret)
|
parse.NestedInlines2FlattedSpans(ret, false)
|
||||||
ret.Root.Spec = "1"
|
ret.Root.Spec = "1"
|
||||||
needFix = true
|
needFix = true
|
||||||
logging.LogInfof("migrated tree [%s] from spec [%s] to [%s]", filePath, oldSpec, ret.Root.Spec)
|
logging.LogInfof("migrated tree [%s] from spec [%s] to [%s]", filePath, oldSpec, ret.Root.Spec)
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ require (
|
||||||
github.com/88250/css v0.1.2
|
github.com/88250/css v0.1.2
|
||||||
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
|
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
|
||||||
github.com/88250/gulu v1.2.3-0.20230615033005-b519d6875346
|
github.com/88250/gulu v1.2.3-0.20230615033005-b519d6875346
|
||||||
github.com/88250/lute v1.7.6-0.20230925081541-b99494256742
|
github.com/88250/lute v1.7.6-0.20230925134424-c4f269de7172
|
||||||
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c
|
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c
|
||||||
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
|
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
|
||||||
github.com/ClarkThan/ahocorasick v0.0.0-20230727142813-c94579738c5b
|
github.com/ClarkThan/ahocorasick v0.0.0-20230727142813-c94579738c5b
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,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/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 h1:U0wZN6zuf+vUhzdHC6DbZE/bY5FUt3FuCwn/KgObV44=
|
||||||
github.com/88250/gulu v1.2.3-0.20230615033005-b519d6875346/go.mod h1:pTWnjt+6qUqNnP9xltswsJxgCBVu3C7eW09u48LWX0k=
|
github.com/88250/gulu v1.2.3-0.20230615033005-b519d6875346/go.mod h1:pTWnjt+6qUqNnP9xltswsJxgCBVu3C7eW09u48LWX0k=
|
||||||
github.com/88250/lute v1.7.6-0.20230925081541-b99494256742 h1:Yxg7G5oZzTDk195TIku9FBoL5hDQ3zswW6j/XRJ9BKA=
|
github.com/88250/lute v1.7.6-0.20230925134424-c4f269de7172 h1:wZagZwg4ez/uaabhjCVuHajOPB5R789NfAMOE4HCjcE=
|
||||||
github.com/88250/lute v1.7.6-0.20230925081541-b99494256742/go.mod h1:+wUqx/1kdFDbWtxn9LYJlaCOAeol2pjSO6w+WJTVQsg=
|
github.com/88250/lute v1.7.6-0.20230925134424-c4f269de7172/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 h1:Dl/8S9iLyPMTElnWIBxmjaLiWrkI5P4a21ivwAn5pU0=
|
||||||
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c/go.mod h1:S5YT38L/GCjVjmB4PB84PymA1qfopjEhfhTNQilLpv4=
|
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=
|
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=
|
||||||
|
|
|
||||||
|
|
@ -1357,6 +1357,27 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 导出数据库 Attribute View export https://github.com/siyuan-note/siyuan/issues/8710
|
||||||
|
for _, tree := range trees {
|
||||||
|
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||||
|
if !entering {
|
||||||
|
return ast.WalkContinue
|
||||||
|
}
|
||||||
|
|
||||||
|
if ast.NodeAttributeView != n.Type {
|
||||||
|
return ast.WalkContinue
|
||||||
|
}
|
||||||
|
|
||||||
|
avID := n.AttributeViewID
|
||||||
|
if avJSONPath := av.GetAttributeViewDataPath(avID); !gulu.File.IsExist(avJSONPath) {
|
||||||
|
return ast.WalkContinue
|
||||||
|
}
|
||||||
|
|
||||||
|
return ast.WalkContinue
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// 导出自定义排序
|
// 导出自定义排序
|
||||||
sortPath := filepath.Join(util.DataDir, box.ID, ".siyuan", "sort.json")
|
sortPath := filepath.Join(util.DataDir, box.ID, ".siyuan", "sort.json")
|
||||||
fullSortIDs := map[string]int{}
|
fullSortIDs := map[string]int{}
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {
|
||||||
for _, tree := range trees {
|
for _, tree := range trees {
|
||||||
syPath := filepath.Join(unzipRootPath, tree.Path)
|
syPath := filepath.Join(unzipRootPath, tree.Path)
|
||||||
if "" == tree.Root.Spec {
|
if "" == tree.Root.Spec {
|
||||||
parse.NestedInlines2FlattedSpans(tree)
|
parse.NestedInlines2FlattedSpans(tree, false)
|
||||||
tree.Root.Spec = "1"
|
tree.Root.Spec = "1"
|
||||||
}
|
}
|
||||||
renderer := render.NewJSONRenderer(tree, luteEngine.RenderOptions)
|
renderer := render.NewJSONRenderer(tree, luteEngine.RenderOptions)
|
||||||
|
|
@ -751,7 +751,7 @@ func parseStdMd(markdown []byte) (ret *parse.Tree) {
|
||||||
}
|
}
|
||||||
genTreeID(ret)
|
genTreeID(ret)
|
||||||
imgHtmlBlock2InlineImg(ret)
|
imgHtmlBlock2InlineImg(ret)
|
||||||
parse.NestedInlines2FlattedSpansHybrid(ret)
|
parse.NestedInlines2FlattedSpansHybrid(ret, false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1070,7 +1070,7 @@ func buildBlockRefInText() {
|
||||||
}
|
}
|
||||||
|
|
||||||
t := parse.Inline("", n.Tokens, lute.ParseOptions) // 使用行级解析
|
t := parse.Inline("", n.Tokens, lute.ParseOptions) // 使用行级解析
|
||||||
parse.NestedInlines2FlattedSpans(t)
|
parse.NestedInlines2FlattedSpans(t, false)
|
||||||
var children []*ast.Node
|
var children []*ast.Node
|
||||||
for c := t.Root.FirstChild.FirstChild; nil != c; c = c.Next {
|
for c := t.Root.FirstChild.FirstChild; nil != c; c = c.Next {
|
||||||
children = append(children, c)
|
children = append(children, c)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue