瀏覽代碼

:recycle: 移除旧版中的行级元素实现代码 https://github.com/siyuan-note/siyuan/issues/6819

Liang Ding 2 年之前
父節點
當前提交
637f1427e4

+ 1 - 19
kernel/model/export.go

@@ -1100,15 +1100,6 @@ func exportTree(tree *parse.Tree, wysiwyg, expandKaTexMacros, keepFold bool) (re
 					return ast.WalkContinue
 					return ast.WalkContinue
 				}
 				}
 			}
 			}
-		case ast.NodeFileAnnotationRef:
-			refIDNode := n.ChildByType(ast.NodeFileAnnotationRefID)
-			if nil == refIDNode {
-				return ast.WalkSkipChildren
-			}
-			refID := refIDNode.TokensStr()
-			status := processFileAnnotationRef(refID, n)
-			unlinks = append(unlinks, n)
-			return status
 		}
 		}
 
 
 		if !treenode.IsBlockRef(n) {
 		if !treenode.IsBlockRef(n) {
@@ -1534,16 +1525,7 @@ func processFileAnnotationRef(refID string, n *ast.Node) ast.WalkStatus {
 	page := int(pages[0].(map[string]interface{})["index"].(float64)) + 1
 	page := int(pages[0].(map[string]interface{})["index"].(float64)) + 1
 	pageStr := strconv.Itoa(page)
 	pageStr := strconv.Itoa(page)
 
 
-	var refText string
-	if ast.NodeTextMark == n.Type {
-		refText = n.TextMarkTextContent
-	} else {
-		refTextNode := n.ChildByType(ast.NodeFileAnnotationRefText)
-		if nil == refTextNode {
-			return ast.WalkSkipChildren
-		}
-		refText = refTextNode.TokensStr()
-	}
+	refText := n.TextMarkTextContent
 	ext := filepath.Ext(p)
 	ext := filepath.Ext(p)
 	file := p[7:len(p)-23-len(ext)] + ext
 	file := p[7:len(p)-23-len(ext)] + ext
 	fileAnnotationRefLink := &ast.Node{Type: ast.NodeLink}
 	fileAnnotationRefLink := &ast.Node{Type: ast.NodeLink}

+ 2 - 7
kernel/model/import.go

@@ -128,17 +128,12 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {
 			if !entering {
 			if !entering {
 				return ast.WalkContinue
 				return ast.WalkContinue
 			}
 			}
+
 			if treenode.IsBlockRef(n) {
 			if treenode.IsBlockRef(n) {
 				defID, _, _ := treenode.GetBlockRef(n)
 				defID, _, _ := treenode.GetBlockRef(n)
 				newDefID := blockIDs[defID]
 				newDefID := blockIDs[defID]
 				if "" != newDefID {
 				if "" != newDefID {
-					if ast.NodeBlockRef == n.Type {
-						if id := n.ChildByType(ast.NodeBlockRefID); nil != id {
-							id.Tokens = []byte(newDefID)
-						}
-					} else {
-						n.TextMarkBlockRefID = newDefID
-					}
+					n.TextMarkBlockRefID = newDefID
 				}
 				}
 			} else if ast.NodeBlockQueryEmbedScript == n.Type {
 			} else if ast.NodeBlockQueryEmbedScript == n.Type {
 				for oldID, newID := range blockIDs {
 				for oldID, newID := range blockIDs {

+ 0 - 5
kernel/model/index.go

@@ -25,7 +25,6 @@ import (
 	"strings"
 	"strings"
 	"time"
 	"time"
 
 
-	"github.com/88250/lute/ast"
 	"github.com/88250/lute/parse"
 	"github.com/88250/lute/parse"
 	"github.com/dustin/go-humanize"
 	"github.com/dustin/go-humanize"
 	"github.com/emirpasic/gods/sets/hashset"
 	"github.com/emirpasic/gods/sets/hashset"
@@ -251,10 +250,6 @@ func IndexRefs() {
 	logging.LogInfof("resolved refs [%d] in [%dms]", len(refBlocks), time.Now().Sub(start).Milliseconds())
 	logging.LogInfof("resolved refs [%d] in [%dms]", len(refBlocks), time.Now().Sub(start).Milliseconds())
 }
 }
 
 
-func isLegacyDynamicBlockRef(blockRef *ast.Node) bool {
-	return nil == blockRef.ChildByType(ast.NodeBlockRefText) && nil == blockRef.ChildByType(ast.NodeBlockRefDynamicText)
-}
-
 func init() {
 func init() {
 	eventbus.Subscribe(eventbus.EvtSQLInsertBlocks, func(context map[string]interface{}, blockCount int, hash string) {
 	eventbus.Subscribe(eventbus.EvtSQLInsertBlocks, func(context map[string]interface{}, blockCount int, hash string) {
 		if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container {
 		if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container {

+ 1 - 4
kernel/model/render.go

@@ -46,10 +46,7 @@ func renderOutline(node *ast.Node, luteEngine *lute.Lute) (ret string) {
 			return ast.WalkContinue
 			return ast.WalkContinue
 		}
 		}
 		switch n.Type {
 		switch n.Type {
-		case ast.NodeBlockRef:
-			buf.WriteString(html.EscapeString(treenode.GetDynamicBlockRefText(n)))
-			return ast.WalkSkipChildren
-		case ast.NodeText, ast.NodeLinkText, ast.NodeFileAnnotationRefText, ast.NodeFootnotesRef, ast.NodeCodeBlockCode, ast.NodeMathBlockContent:
+		case ast.NodeText, ast.NodeLinkText, ast.NodeFootnotesRef, ast.NodeCodeBlockCode, ast.NodeMathBlockContent:
 			tokens := html.EscapeHTML(n.Tokens)
 			tokens := html.EscapeHTML(n.Tokens)
 			tokens = bytes.ReplaceAll(tokens, []byte(" "), []byte(" ")) // 大纲面板条目中无法显示多个空格 https://github.com/siyuan-note/siyuan/issues/4370
 			tokens = bytes.ReplaceAll(tokens, []byte(" "), []byte(" ")) // 大纲面板条目中无法显示多个空格 https://github.com/siyuan-note/siyuan/issues/4370
 			buf.Write(tokens)
 			buf.Write(tokens)

+ 7 - 37
kernel/model/template.go

@@ -20,15 +20,6 @@ import (
 	"bytes"
 	"bytes"
 	"errors"
 	"errors"
 	"fmt"
 	"fmt"
-	"io/fs"
-	"os"
-	"path/filepath"
-	"sort"
-	"strings"
-	"text/template"
-	"time"
-	"unicode/utf8"
-
 	"github.com/88250/lute/ast"
 	"github.com/88250/lute/ast"
 	"github.com/88250/lute/parse"
 	"github.com/88250/lute/parse"
 	"github.com/88250/lute/render"
 	"github.com/88250/lute/render"
@@ -36,6 +27,13 @@ import (
 	"github.com/siyuan-note/logging"
 	"github.com/siyuan-note/logging"
 	"github.com/siyuan-note/siyuan/kernel/treenode"
 	"github.com/siyuan-note/siyuan/kernel/treenode"
 	"github.com/siyuan-note/siyuan/kernel/util"
 	"github.com/siyuan-note/siyuan/kernel/util"
+	"io/fs"
+	"os"
+	"path/filepath"
+	"sort"
+	"strings"
+	"text/template"
+	"time"
 
 
 	"github.com/88250/gulu"
 	"github.com/88250/gulu"
 	sprig "github.com/Masterminds/sprig/v3"
 	sprig "github.com/Masterminds/sprig/v3"
@@ -224,15 +222,6 @@ func renderTemplate(p, id string) (string, error) {
 					unlinks = append(unlinks, n)
 					unlinks = append(unlinks, n)
 				}
 				}
 			}
 			}
-		} else if ast.NodeBlockRef == n.Type {
-			if idNode := n.ChildByType(ast.NodeBlockRefID); nil != idNode {
-				refText := sql.GetRefText(idNode.TokensStr())
-				if "" != refText {
-					treenode.SetDynamicBlockRefText(n, refText)
-				} else {
-					unlinks = append(unlinks, n)
-				}
-			}
 		}
 		}
 		return ast.WalkContinue
 		return ast.WalkContinue
 	})
 	})
@@ -260,25 +249,6 @@ func renderTemplate(p, id string) (string, error) {
 	return dom, nil
 	return dom, nil
 }
 }
 
 
-func appendRefTextRenderResultForBlockRef(blockRef *ast.Node) {
-	if !treenode.IsBlockRef(blockRef) {
-		return
-	}
-
-	refID, text, _ := treenode.GetBlockRef(blockRef)
-	if "" != text {
-		return
-	}
-
-	// 动态解析渲染 ((id)) 的锚文本
-	// 现行版本已经不存在该语法情况,这里保留是为了迁移历史数据
-	text = sql.GetRefText(refID)
-	if Conf.Editor.BlockRefDynamicAnchorTextMaxLen < utf8.RuneCountInString(text) {
-		text = gulu.Str.SubStr(text, Conf.Editor.BlockRefDynamicAnchorTextMaxLen) + "..."
-	}
-	blockRef.AppendChild(&ast.Node{Type: ast.NodeBlockRefDynamicText, Tokens: gulu.Str.ToBytes(text)})
-}
-
 func addBlockIALNodes(tree *parse.Tree, removeUpdated bool) {
 func addBlockIALNodes(tree *parse.Tree, removeUpdated bool) {
 	var blocks []*ast.Node
 	var blocks []*ast.Node
 	ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
 	ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {

+ 0 - 2
kernel/model/transaction.go

@@ -909,8 +909,6 @@ func (tx *Transaction) doUpdate(operation *Operation) (ret *TxErr) {
 					}
 					}
 				}
 				}
 			}
 			}
-		} else if ast.NodeBlockRef == n.Type {
-			sql.CacheRef(subTree, n)
 		}
 		}
 		return ast.WalkContinue
 		return ast.WalkContinue
 	})
 	})

+ 1 - 3
kernel/model/tree.go

@@ -91,9 +91,7 @@ func resetTree(tree *parse.Tree, titleSuffix string) {
 			return ast.WalkContinue
 			return ast.WalkContinue
 		}
 		}
 		if "1" != refIDs[defID] {
 		if "1" != refIDs[defID] {
-			if ast.NodeBlockRefID == n.Type {
-				n.Tokens = []byte(refIDs[defID])
-			} else if ast.NodeTextMark == n.Type {
+			if ast.NodeTextMark == n.Type {
 				n.TextMarkBlockRefID = refIDs[defID]
 				n.TextMarkBlockRefID = refIDs[defID]
 			}
 			}
 		}
 		}

+ 1 - 12
kernel/sql/block_query.go

@@ -656,21 +656,10 @@ func GetContainerText(container *ast.Node) string {
 			return ast.WalkContinue
 			return ast.WalkContinue
 		}
 		}
 		switch n.Type {
 		switch n.Type {
-		case ast.NodeText, ast.NodeLinkText, ast.NodeFileAnnotationRefText, ast.NodeFootnotesRef,
-			ast.NodeCodeBlockCode, ast.NodeMathBlockContent:
+		case ast.NodeText, ast.NodeLinkText, ast.NodeCodeBlockCode, ast.NodeMathBlockContent:
 			buf.Write(n.Tokens)
 			buf.Write(n.Tokens)
 		case ast.NodeTextMark:
 		case ast.NodeTextMark:
 			buf.WriteString(n.Content())
 			buf.WriteString(n.Content())
-		case ast.NodeBlockRef:
-			if anchor := n.ChildByType(ast.NodeBlockRefText); nil != anchor {
-				buf.WriteString(anchor.Text())
-			} else if anchor = n.ChildByType(ast.NodeBlockRefDynamicText); nil != anchor {
-				buf.WriteString(anchor.Text())
-			} else {
-				text := GetRefText(n.TokensStr())
-				buf.WriteString(text)
-			}
-			return ast.WalkSkipChildren
 		}
 		}
 		return ast.WalkContinue
 		return ast.WalkContinue
 	})
 	})

+ 0 - 121
kernel/sql/database.go

@@ -276,34 +276,6 @@ func refsFromTree(tree *parse.Tree) (refs []*Ref, fileAnnotationRefs []*FileAnno
 		if treenode.IsBlockRef(n) {
 		if treenode.IsBlockRef(n) {
 			ref := buildRef(tree, n)
 			ref := buildRef(tree, n)
 			refs = append(refs, ref)
 			refs = append(refs, ref)
-		} else if ast.NodeFileAnnotationRefID == n.Type {
-			pathID := n.TokensStr()
-			idx := strings.LastIndex(pathID, "/")
-			if -1 == idx {
-				return ast.WalkContinue
-			}
-
-			filePath := pathID[:idx]
-			annotationID := pathID[idx+1:]
-
-			anchor := n.Parent.ChildByType(ast.NodeFileAnnotationRefText)
-			text := filePath
-			if nil != anchor {
-				text = anchor.Text()
-			}
-			parentBlock := treenode.ParentBlock(n)
-			ref := &FileAnnotationRef{
-				ID:           ast.NewNodeID(),
-				FilePath:     filePath,
-				AnnotationID: annotationID,
-				BlockID:      parentBlock.ID,
-				RootID:       tree.ID,
-				Box:          tree.Box,
-				Path:         tree.Path,
-				Content:      text,
-				Type:         treenode.TypeAbbr(n.Type.String()),
-			}
-			fileAnnotationRefs = append(fileAnnotationRefs, ref)
 		} else if ast.NodeTextMark == n.Type && n.IsTextMarkType("file-annotation-ref") {
 		} else if ast.NodeTextMark == n.Type && n.IsTextMarkType("file-annotation-ref") {
 			pathID := n.TextMarkFileAnnotationRefID
 			pathID := n.TextMarkFileAnnotationRefID
 			idx := strings.LastIndex(pathID, "/")
 			idx := strings.LastIndex(pathID, "/")
@@ -365,99 +337,6 @@ func buildRef(tree *parse.Tree, refNode *ast.Node) *Ref {
 	}
 	}
 }
 }
 
 
-func ResolveRefContent(block *Block, anchors *map[string]string) (ret string) {
-	if "d" == block.Type {
-		(*anchors)[block.ID] = block.Content
-		return block.Content
-	}
-
-	tree := parse.Parse("", []byte(block.Markdown), luteEngine.ParseOptions)
-	depth := 0
-	var stack []string
-	c := treenode.FirstLeafBlock(tree.Root)
-	ret = resolveRefContent0(c, anchors, &depth, &stack)
-	return
-}
-
-func resolveRefContent0(node *ast.Node, anchors *map[string]string, depth *int, stack *[]string) (ret string) {
-	*depth++
-	if 7 < *depth {
-		return ""
-	}
-	if ast.NodeBlockRefID == node.Type {
-		id := node.TokensStr()
-		var ok bool
-		if ret, ok = (*anchors)[id]; ok {
-			return ret
-		}
-
-		if gulu.Str.Contains(id, *stack) {
-			return ""
-		}
-
-		defBlock := GetBlock(id)
-		if nil == defBlock {
-			return "block not found"
-		}
-
-		if "" != defBlock.Name {
-			(*anchors)[id] = defBlock.Name
-			return defBlock.Name
-		}
-
-		if "d" == defBlock.Type {
-			(*anchors)[id] = defBlock.Content
-			return defBlock.Content
-		}
-
-		tree := parse.Parse("", gulu.Str.ToBytes(defBlock.Markdown), luteEngine.ParseOptions)
-		c := treenode.FirstLeafBlock(tree.Root)
-		*stack = append(*stack, id)
-		ret = resolveRefContent0(c, anchors, depth, stack)
-		(*anchors)[id] = ret
-		return
-	}
-
-	buf := &bytes.Buffer{}
-	buf.Grow(4096)
-	ast.Walk(node, func(n *ast.Node, entering bool) ast.WalkStatus {
-		if !entering {
-			return ast.WalkContinue
-		}
-		switch n.Type {
-		case ast.NodeDocument:
-			buf.WriteString(n.IALAttr("title"))
-			return ast.WalkStop
-		case ast.NodeText, ast.NodeLinkText, ast.NodeLinkTitle, ast.NodeFileAnnotationRefText, ast.NodeFootnotesRef,
-			ast.NodeCodeBlockCode, ast.NodeMathBlockContent:
-			buf.Write(n.Tokens)
-		case ast.NodeTextMark:
-			if n.IsTextMarkType("tag") {
-				buf.WriteByte('#')
-			}
-			buf.WriteString(n.Content())
-			if n.IsTextMarkType("tag") {
-				buf.WriteByte('#')
-			}
-		case ast.NodeBlockRef:
-			if anchor := n.ChildByType(ast.NodeBlockRefText); nil != anchor {
-				buf.WriteString(anchor.Text())
-				return ast.WalkSkipChildren
-			} else if anchor = n.ChildByType(ast.NodeBlockRefDynamicText); nil != anchor {
-				buf.WriteString(anchor.Text())
-				return ast.WalkSkipChildren
-			}
-
-			defID := n.ChildByType(ast.NodeBlockRefID)
-			anchor := resolveRefContent0(defID, anchors, depth, stack)
-			(*anchors)[defID.TokensStr()] = anchor
-			buf.WriteString(anchor)
-		}
-		return ast.WalkContinue
-	})
-	return buf.String()
-}
-
 func fromTree(node *ast.Node, tree *parse.Tree) (blocks []*Block, spans []*Span, assets []*Asset, attributes []*Attribute) {
 func fromTree(node *ast.Node, tree *parse.Tree) (blocks []*Block, spans []*Span, assets []*Asset, attributes []*Attribute) {
 	rootID := tree.Root.ID
 	rootID := tree.Root.ID
 	boxID := tree.Box
 	boxID := tree.Box

+ 0 - 25
kernel/sql/upsert.go

@@ -27,7 +27,6 @@ import (
 	"github.com/emirpasic/gods/sets/hashset"
 	"github.com/emirpasic/gods/sets/hashset"
 	"github.com/siyuan-note/eventbus"
 	"github.com/siyuan-note/eventbus"
 	"github.com/siyuan-note/logging"
 	"github.com/siyuan-note/logging"
-	"github.com/siyuan-note/siyuan/kernel/treenode"
 	"github.com/siyuan-note/siyuan/kernel/util"
 	"github.com/siyuan-note/siyuan/kernel/util"
 )
 )
 
 
@@ -473,30 +472,6 @@ func upsertTree(tx *sql.Tx, tree *parse.Tree, context map[string]interface{}) (e
 	if err = insertBlocks(tx, blocks, context); nil != err {
 	if err = insertBlocks(tx, blocks, context); nil != err {
 		return
 		return
 	}
 	}
-	anchors := map[string]string{}
-	var refIDs []string
-	for _, block := range blocks {
-		if "" != block.Content {
-			// content 不为空的话说明是定值,不需要解析引用内容
-			continue
-		}
-		subTree := parse.Parse("", []byte(block.Markdown), luteEngine.ParseOptions)
-		if nil == subTree {
-			logging.LogErrorf("parse temp block [%s] failed: %s", block.ID, err)
-			continue
-		}
-		if 0 < len(treenode.GetLegacyDynamicBlockRefDefIDs(subTree.Root)) {
-			refIDs = append(refIDs, block.ID)
-		}
-	}
-	// 先删除再插入会快很多
-	refBlocks := GetBlocks(refIDs)
-	for _, refBlock := range refBlocks {
-		blockContent := ResolveRefContent(refBlock, &anchors)
-		refBlock.Content = blockContent
-	}
-	deleteBlocksByIDs(tx, refIDs)
-	insertBlocks(tx, refBlocks, context)
 
 
 	refs, fileAnnotationRefs := refsFromTree(tree)
 	refs, fileAnnotationRefs := refsFromTree(tree)
 	if err = insertRefs(tx, refs); nil != err {
 	if err = insertRefs(tx, refs); nil != err {

+ 11 - 87
kernel/treenode/node.go

@@ -36,30 +36,10 @@ func GetBlockRef(n *ast.Node) (blockRefID, blockRefText, blockRefSubtype string)
 	if !IsBlockRef(n) {
 	if !IsBlockRef(n) {
 		return
 		return
 	}
 	}
-	if ast.NodeBlockRef == n.Type {
-		id := n.ChildByType(ast.NodeBlockRefID)
-		if nil == id {
-			return
-		}
-		blockRefID = id.TokensStr()
-		text := n.ChildByType(ast.NodeBlockRefText)
-		if nil != text {
-			blockRefText = text.Text()
-			blockRefSubtype = "s"
-			return
-		}
-		text = n.ChildByType(ast.NodeBlockRefDynamicText)
-		if nil != text {
-			blockRefText = text.Text()
-			blockRefSubtype = "d"
-			return
-		}
-	}
-	if ast.NodeTextMark == n.Type {
-		blockRefID = n.TextMarkBlockRefID
-		blockRefText = n.TextMarkTextContent
-		blockRefSubtype = n.TextMarkBlockRefSubtype
-	}
+
+	blockRefID = n.TextMarkBlockRefID
+	blockRefText = n.TextMarkTextContent
+	blockRefSubtype = n.TextMarkBlockRefSubtype
 	return
 	return
 }
 }
 
 
@@ -67,13 +47,7 @@ func IsBlockRef(n *ast.Node) bool {
 	if nil == n {
 	if nil == n {
 		return false
 		return false
 	}
 	}
-	if ast.NodeBlockRef == n.Type {
-		return true
-	}
-	if ast.NodeTextMark == n.Type {
-		return n.IsTextMarkType("block-ref")
-	}
-	return false
+	return ast.NodeTextMark == n.Type && n.IsTextMarkType("block-ref")
 }
 }
 
 
 func NodeStaticMdContent(node *ast.Node, luteEngine *lute.Lute) (md, content string) {
 func NodeStaticMdContent(node *ast.Node, luteEngine *lute.Lute) (md, content string) {
@@ -126,10 +100,6 @@ func NodeStaticContent(node *ast.Node) string {
 		}
 		}
 
 
 		switch n.Type {
 		switch n.Type {
-		case ast.NodeBlockRef:
-			buf.WriteString(GetDynamicBlockRefText(n))
-			lastSpace = false
-			return ast.WalkSkipChildren
 		case ast.NodeLinkText:
 		case ast.NodeLinkText:
 			buf.Write(n.Tokens)
 			buf.Write(n.Tokens)
 			buf.WriteByte(' ')
 			buf.WriteByte(' ')
@@ -138,7 +108,7 @@ func NodeStaticContent(node *ast.Node) string {
 			buf.WriteByte(' ')
 			buf.WriteByte(' ')
 		case ast.NodeLinkTitle:
 		case ast.NodeLinkTitle:
 			buf.Write(n.Tokens)
 			buf.Write(n.Tokens)
-		case ast.NodeText, ast.NodeFileAnnotationRefText, ast.NodeFootnotesRef, ast.NodeCodeBlockCode, ast.NodeMathBlockContent, ast.NodeHTMLBlock:
+		case ast.NodeText, ast.NodeCodeBlockCode, ast.NodeMathBlockContent, ast.NodeHTMLBlock:
 			tokens := n.Tokens
 			tokens := n.Tokens
 			if IsChartCodeBlockCode(n) {
 			if IsChartCodeBlockCode(n) {
 				// 图表块的内容在数据库 `blocks` 表 `content` 字段中被转义 https://github.com/siyuan-note/siyuan/issues/6326
 				// 图表块的内容在数据库 `blocks` 表 `content` 字段中被转义 https://github.com/siyuan-note/siyuan/issues/6326
@@ -284,12 +254,11 @@ var typeAbbrMap = map[string]string{
 	"NodeVideo":            "video",
 	"NodeVideo":            "video",
 	"NodeAudio":            "audio",
 	"NodeAudio":            "audio",
 	// 行级元素 TODO: 移除旧版中的行级元素实现代码 https://github.com/siyuan-note/siyuan/issues/6819
 	// 行级元素 TODO: 移除旧版中的行级元素实现代码 https://github.com/siyuan-note/siyuan/issues/6819
-	"NodeText":       "text",
-	"NodeImage":      "img",
-	"NodeLinkText":   "link_text",
-	"NodeLinkDest":   "link_dest",
-	"NodeBlockRefID": "ref_id",
-	"NodeTextMark":   "textmark",
+	"NodeText":     "text",
+	"NodeImage":    "img",
+	"NodeLinkText": "link_text",
+	"NodeLinkDest": "link_dest",
+	"NodeTextMark": "textmark",
 }
 }
 
 
 var abbrTypeMap = map[string]string{}
 var abbrTypeMap = map[string]string{}
@@ -343,20 +312,6 @@ func SubTypeAbbr(n *ast.Node) string {
 	return ""
 	return ""
 }
 }
 
 
-func GetLegacyDynamicBlockRefDefIDs(node *ast.Node) (ret []string) {
-	ast.Walk(node, func(n *ast.Node, entering bool) ast.WalkStatus {
-		if !entering {
-			return ast.WalkContinue
-		}
-		if ast.NodeBlockRefID == n.Type && ast.NodeCloseParen == n.Next.Type {
-			ret = append(ret, n.TokensStr())
-			return ast.WalkSkipChildren
-		}
-		return ast.WalkContinue
-	})
-	return
-}
-
 var DynamicRefTexts = sync.Map{}
 var DynamicRefTexts = sync.Map{}
 
 
 func SetDynamicBlockRefText(blockRef *ast.Node, refText string) {
 func SetDynamicBlockRefText(blockRef *ast.Node, refText string) {
@@ -364,25 +319,6 @@ func SetDynamicBlockRefText(blockRef *ast.Node, refText string) {
 		return
 		return
 	}
 	}
 
 
-	if ast.NodeBlockRef == blockRef.Type {
-		idNode := blockRef.ChildByType(ast.NodeBlockRefID)
-		if nil == idNode {
-			return
-		}
-
-		var spacesRefTexts []*ast.Node // 可能会有多个空格,或者遗留错误插入的锚文本节点,这里做一次订正
-		for n := idNode.Next; ast.NodeCloseParen != n.Type; n = n.Next {
-			spacesRefTexts = append(spacesRefTexts, n)
-		}
-		for _, toRemove := range spacesRefTexts {
-			toRemove.Unlink()
-		}
-		refText = strings.TrimSpace(refText)
-		idNode.InsertAfter(&ast.Node{Type: ast.NodeBlockRefDynamicText, Tokens: []byte(refText)})
-		idNode.InsertAfter(&ast.Node{Type: ast.NodeBlockRefSpace})
-		return
-	}
-
 	blockRef.TextMarkBlockRefSubtype = "d"
 	blockRef.TextMarkBlockRefSubtype = "d"
 	blockRef.TextMarkTextContent = refText
 	blockRef.TextMarkTextContent = refText
 
 
@@ -390,18 +326,6 @@ func SetDynamicBlockRefText(blockRef *ast.Node, refText string) {
 	DynamicRefTexts.Store(blockRef.TextMarkBlockRefID, refText)
 	DynamicRefTexts.Store(blockRef.TextMarkBlockRefID, refText)
 }
 }
 
 
-func GetDynamicBlockRefText(blockRef *ast.Node) string {
-	refText := blockRef.ChildByType(ast.NodeBlockRefText)
-	if nil != refText {
-		return refText.Text()
-	}
-	refText = blockRef.ChildByType(ast.NodeBlockRefDynamicText)
-	if nil != refText {
-		return refText.Text()
-	}
-	return "ref resolve failed"
-}
-
 func IsChartCodeBlockCode(code *ast.Node) bool {
 func IsChartCodeBlockCode(code *ast.Node) bool {
 	if nil == code.Previous || ast.NodeCodeBlockFenceInfoMarker != code.Previous.Type || 1 > len(code.Previous.CodeBlockInfo) {
 	if nil == code.Previous || ast.NodeCodeBlockFenceInfoMarker != code.Previous.Type || 1 > len(code.Previous.CodeBlockInfo) {
 		return false
 		return false