This commit is contained in:
Daniel 2024-11-27 20:55:13 +08:00
parent f716e16e37
commit eb21e8f90f
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -1966,8 +1966,17 @@ func exportMarkdownContent0(tree *parse.Tree, cloudAssetsBase string, assetsDest
anchorSpan := &ast.Node{Type: ast.NodeInlineHTML, Tokens: []byte("<span id=\"" + n.ID + "\"></span>")}
if ast.NodeDocument != n.Type {
firstLeaf := treenode.FirstLeafBlock(n)
if nil != firstLeaf && nil != firstLeaf.FirstChild {
firstLeaf.FirstChild.InsertBefore(anchorSpan)
if nil != firstLeaf {
if ast.NodeTable == firstLeaf.Type {
firstLeaf.InsertBefore(anchorSpan)
firstLeaf.InsertBefore(&ast.Node{Type: ast.NodeHardBreak})
} else {
if nil != firstLeaf.FirstChild {
firstLeaf.FirstChild.InsertBefore(anchorSpan)
} else {
firstLeaf.AppendChild(anchorSpan)
}
}
} else {
n.AppendChild(anchorSpan)
}