Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve node parsing

Daniel68be7bdfe407
diff --git a/kernel/filesys/json_parser.go b/kernel/filesys/json_parser.go
index 81cbe6b30e..bf7a817533 100644
--- a/kernel/filesys/json_parser.go
+++ b/kernel/filesys/json_parser.go
@@ -232,6 +232,9 @@ func fixLegacyData(tip, node *ast.Node, idMap *map[string]bool, needFix, needMig
// 建立索引时无法解析 `v2.2.0-` 版本的块引用 https://github.com/siyuan-note/siyuan/issues/6889
// 早先的迁移程序有缺陷,漏迁移了块引用节点,这里检测到块引用节点后标识需要迁移
*needMigrate2Spec1 = true
+ case ast.NodeInlineHTML:
+ *needFix = true
+ node.Type = ast.NodeHTMLBlock
}
for _, kv := range node.KramdownIAL {
diff --git a/kernel/sql/database.go b/kernel/sql/database.go
index afec892fa3..9227cf4544 100644
--- a/kernel/sql/database.go
+++ b/kernel/sql/database.go
@@ -689,6 +689,16 @@ func buildSpanFromNode(n *ast.Node, tree *parse.Tree, rootID, boxID, p string) (
attributes = append(attributes, attrs...)
}
+ if ast.NodeInlineHTML == n.Type {
+ // 没有行级 HTML,只有块级 HTML,这里转换为块
+ b, attrs := buildBlockFromNode(n, tree)
+ b.Type = ast.NodeHTMLBlock.String()
+ blocks = append(blocks, b)
+ attributes = append(attributes, attrs...)
+ walkStatus = ast.WalkContinue
+ return
+ }
+
if 1 > len(nodes) {
walkStatus = ast.WalkContinue
return