🎨 Improve exporting Markdown https://github.com/siyuan-note/siyuan/issues/13273
This commit is contained in:
parent
f716e16e37
commit
eb21e8f90f
1 changed files with 11 additions and 2 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue