mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 Remove empty code block node from ast https://ld246.com/article/1713689223067
This commit is contained in:
parent
4be13b8518
commit
1a62006e1c
1 changed files with 15 additions and 0 deletions
|
|
@ -144,6 +144,21 @@ func genTreeByJSON(node *ast.Node, tree *parse.Tree, idMap *map[string]bool, nee
|
||||||
*needFix = true
|
*needFix = true
|
||||||
return // 忽略空查询嵌入块
|
return // 忽略空查询嵌入块
|
||||||
}
|
}
|
||||||
|
case ast.NodeCodeBlock:
|
||||||
|
if 4 > len(node.Children) {
|
||||||
|
// https://ld246.com/article/1713689223067
|
||||||
|
existCode := false
|
||||||
|
for _, child := range node.Children {
|
||||||
|
if ast.NodeCodeBlockCode.String() == child.TypeStr {
|
||||||
|
existCode = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !existCode {
|
||||||
|
*needFix = true
|
||||||
|
return // 忽略空代码块
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fixLegacyData(tree.Context.Tip, node, idMap, needFix, needMigrate2Spec1)
|
fixLegacyData(tree.Context.Tip, node, idMap, needFix, needMigrate2Spec1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue