🎨 Block ref elements support font styles when exporting https://github.com/siyuan-note/siyuan/issues/10179

This commit is contained in:
Daniel 2024-01-15 22:52:22 +08:00
parent e0fb872cbf
commit 0e720f8d36
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
4 changed files with 10 additions and 12 deletions

View file

@ -2035,16 +2035,14 @@ func exportTree(tree *parse.Tree, wysiwyg, expandKaTexMacros, keepFold bool,
switch blockRefMode {
case 2: // 锚文本块链
var blockRefLink *ast.Node
blockRefLink = &ast.Node{Type: ast.NodeLink}
blockRefLink.AppendChild(&ast.Node{Type: ast.NodeOpenBracket})
blockRefLink.AppendChild(&ast.Node{Type: ast.NodeLinkText, Tokens: []byte(linkText)})
blockRefLink.AppendChild(&ast.Node{Type: ast.NodeCloseBracket})
blockRefLink.AppendChild(&ast.Node{Type: ast.NodeOpenParen})
blockRefLink.AppendChild(&ast.Node{Type: ast.NodeLinkDest, Tokens: []byte("siyuan://blocks/" + defID)})
blockRefLink.AppendChild(&ast.Node{Type: ast.NodeCloseParen})
blockRefLink = &ast.Node{Type: ast.NodeTextMark, TextMarkType: "a", TextMarkTextContent: linkText, TextMarkAHref: "siyuan://blocks/" + defID}
blockRefLink.KramdownIAL = n.KramdownIAL
n.InsertBefore(blockRefLink)
case 3: // 仅锚文本
n.InsertBefore(&ast.Node{Type: ast.NodeText, Tokens: []byte(linkText)})
var blockRefLink *ast.Node
blockRefLink = &ast.Node{Type: ast.NodeTextMark, TextMarkType: "text", TextMarkTextContent: linkText}
blockRefLink.KramdownIAL = n.KramdownIAL
n.InsertBefore(blockRefLink)
case 4: // 脚注
refFoot := getRefAsFootnotes(defID, &refFootnotes)
n.InsertBefore(&ast.Node{Type: ast.NodeText, Tokens: []byte(linkText)})