mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
🎨 Improve exporting block ref style https://github.com/siyuan-note/siyuan/issues/16017
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
10690ba3f7
commit
186684b183
1 changed files with 4 additions and 19 deletions
|
|
@ -2288,24 +2288,9 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool,
|
||||||
n.InsertBefore(blockRefLink)
|
n.InsertBefore(blockRefLink)
|
||||||
unlinks = append(unlinks, n)
|
unlinks = append(unlinks, n)
|
||||||
case 3: // 仅锚文本
|
case 3: // 仅锚文本
|
||||||
var blockRefLink *ast.Node
|
blockRefLink := &ast.Node{Type: ast.NodeTextMark, TextMarkType: strings.TrimSpace(strings.ReplaceAll(n.TextMarkType, "block-ref", "")), TextMarkTextContent: linkText}
|
||||||
if 0 < len(n.KramdownIAL) {
|
|
||||||
blockRefLink = &ast.Node{Type: ast.NodeTextMark, TextMarkType: "text", TextMarkTextContent: linkText}
|
|
||||||
blockRefLink.KramdownIAL = n.KramdownIAL
|
blockRefLink.KramdownIAL = n.KramdownIAL
|
||||||
|
|
||||||
if n.IsTextMarkType("inline-memo") {
|
|
||||||
blockRefLink.TextMarkInlineMemoContent = n.TextMarkInlineMemoContent
|
blockRefLink.TextMarkInlineMemoContent = n.TextMarkInlineMemoContent
|
||||||
blockRefLink.TextMarkType = "text inline-memo"
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
blockRefLink = &ast.Node{Type: ast.NodeText, Tokens: []byte(linkText)}
|
|
||||||
if "block-ref" != n.TextMarkType {
|
|
||||||
blockRefLink.Type = ast.NodeTextMark
|
|
||||||
blockRefLink.TextMarkType = strings.TrimSpace(strings.ReplaceAll(n.TextMarkType, "block-ref", ""))
|
|
||||||
blockRefLink.TextMarkTextContent = linkText
|
|
||||||
blockRefLink.TextMarkInlineMemoContent = n.TextMarkInlineMemoContent
|
|
||||||
}
|
|
||||||
}
|
|
||||||
n.InsertBefore(blockRefLink)
|
n.InsertBefore(blockRefLink)
|
||||||
unlinks = append(unlinks, n)
|
unlinks = append(unlinks, n)
|
||||||
case 4: // 脚注+锚点哈希
|
case 4: // 脚注+锚点哈希
|
||||||
|
|
@ -2999,7 +2984,7 @@ func blockLink2Ref0(currentTree *parse.Tree, node *ast.Node, treeCache map[strin
|
||||||
}
|
}
|
||||||
|
|
||||||
if treenode.IsBlockLink(n) {
|
if treenode.IsBlockLink(n) {
|
||||||
n.TextMarkType = "block-ref"
|
n.TextMarkType = strings.TrimSpace(strings.TrimPrefix(n.TextMarkType, "a") + " block-ref")
|
||||||
n.TextMarkBlockRefID = strings.TrimPrefix(n.TextMarkAHref, "siyuan://blocks/")
|
n.TextMarkBlockRefID = strings.TrimPrefix(n.TextMarkAHref, "siyuan://blocks/")
|
||||||
n.TextMarkBlockRefSubtype = "s"
|
n.TextMarkBlockRefSubtype = "s"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue