This commit is contained in:
Daniel 2024-08-05 21:24:41 +08:00
parent 86f574a216
commit ff19cc08af
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -113,14 +113,6 @@ func genTreeByJSON(node *ast.Node, tree *parse.Tree, idMap *map[string]bool, nee
node.Children = nil
}
if node.IsBlock() {
if node.ID != node.IALAttr("id") {
//某些情况下会导致 ID 和属性 id 不相同 https://ld246.com/article/1722826829447
*needFix = true
node.SetIALAttr("id", node.ID)
}
}
switch node.Type {
case ast.NodeList:
if 1 > len(node.Children) {
@ -191,6 +183,13 @@ func fixLegacyData(tip, node *ast.Node, idMap *map[string]bool, needFix, needMig
node.SetIALAttr("id", node.ID)
*needFix = true
}
if node.ID != node.IALAttr("id") {
//某些情况下会导致 ID 和属性 id 不相同 https://ld246.com/article/1722826829447
*needFix = true
node.SetIALAttr("id", node.ID)
}
if 0 < len(node.Children) && ast.NodeBr.String() == node.Children[len(node.Children)-1].TypeStr {
// 剔除块尾多余的软换行 https://github.com/siyuan-note/siyuan/issues/6191
node.Children = node.Children[:len(node.Children)-1]