🎨 Add a Ref export mode Anchor hash for notebook Markdown exporting https://github.com/siyuan-note/siyuan/issues/10265

This commit is contained in:
Daniel 2024-01-28 10:51:31 +08:00
parent 9ffa5b7e82
commit f59f738e5e
No known key found for this signature in database
GPG Key ID: 86211BA83DF03017

View File

@ -1838,8 +1838,9 @@ 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 {
if nil != n.FirstChild {
n.FirstChild.InsertBefore(anchorSpan)
firstLeaf := treenode.FirstLeafBlock(n)
if nil != firstLeaf && nil != firstLeaf.FirstChild {
firstLeaf.FirstChild.InsertBefore(anchorSpan)
} else {
n.AppendChild(anchorSpan)
}