diff --git a/kernel/model/box.go b/kernel/model/box.go index ab2d262cc..0d89c81cf 100644 --- a/kernel/model/box.go +++ b/kernel/model/box.go @@ -513,7 +513,7 @@ func normalizeTree(tree *parse.Tree) (yfmRootID, yfmTitle, yfmUpdated string) { } id := n.IALAttr("id") - if "" == id { + if "" == id && n.IsBlock() { n.SetIALAttr("id", n.ID) } diff --git a/kernel/sql/database.go b/kernel/sql/database.go index 80110567d..775f80efa 100644 --- a/kernel/sql/database.go +++ b/kernel/sql/database.go @@ -741,11 +741,15 @@ func buildSpanFromNode(n *ast.Node, tree *parse.Tree, rootID, boxID, p string) ( if ast.NodeInlineHTML == n.Type { // 没有行级 HTML,只有块级 HTML,这里转换为块 + n.ID = ast.NewNodeID() + n.SetIALAttr("id", n.ID) + n.SetIALAttr("updated", n.ID[:14]) b, attrs := buildBlockFromNode(n, tree) b.Type = ast.NodeHTMLBlock.String() blocks = append(blocks, b) attributes = append(attributes, attrs...) walkStatus = ast.WalkContinue + logging.LogWarnf("inline HTML [%s] is converted to HTML block ", n.Tokens) return }