mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
🎨 支持搜索超链接元素 URL Fix https://github.com/siyuan-note/siyuan/issues/5273
This commit is contained in:
parent
a6522c59c8
commit
57c094ee15
2 changed files with 27 additions and 2 deletions
|
|
@ -506,6 +506,22 @@ func buildSpanFromNode(n *ast.Node, tree *parse.Tree, rootID, boxID, p string) (
|
||||||
walkStatus = ast.WalkSkipChildren
|
walkStatus = ast.WalkSkipChildren
|
||||||
return
|
return
|
||||||
case ast.NodeLinkDest:
|
case ast.NodeLinkDest:
|
||||||
|
text := n.TokensStr()
|
||||||
|
markdown := treenode.FormatNode(n.Parent, luteEngine)
|
||||||
|
parentBlock := treenode.ParentBlock(n)
|
||||||
|
span := &Span{
|
||||||
|
ID: ast.NewNodeID(),
|
||||||
|
BlockID: parentBlock.ID,
|
||||||
|
RootID: rootID,
|
||||||
|
Box: boxID,
|
||||||
|
Path: p,
|
||||||
|
Content: text,
|
||||||
|
Markdown: markdown,
|
||||||
|
Type: treenode.TypeAbbr(n.Type.String()),
|
||||||
|
IAL: treenode.IALStr(n),
|
||||||
|
}
|
||||||
|
spans = append(spans, span)
|
||||||
|
|
||||||
// assetsLinkDestsInTree
|
// assetsLinkDestsInTree
|
||||||
|
|
||||||
if !IsAssetLinkDest(n.Tokens) {
|
if !IsAssetLinkDest(n.Tokens) {
|
||||||
|
|
@ -514,7 +530,7 @@ func buildSpanFromNode(n *ast.Node, tree *parse.Tree, rootID, boxID, p string) (
|
||||||
}
|
}
|
||||||
|
|
||||||
dest := gulu.Str.FromBytes(n.Tokens)
|
dest := gulu.Str.FromBytes(n.Tokens)
|
||||||
parentBlock := treenode.ParentBlock(n)
|
parentBlock = treenode.ParentBlock(n)
|
||||||
var title string
|
var title string
|
||||||
if titleNode := n.Parent.ChildByType(ast.NodeLinkTitle); nil != titleNode {
|
if titleNode := n.Parent.ChildByType(ast.NodeLinkTitle); nil != titleNode {
|
||||||
title = gulu.Str.FromBytes(titleNode.Tokens)
|
title = gulu.Str.FromBytes(titleNode.Tokens)
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,15 @@ func NodeStaticContent(node *ast.Node) string {
|
||||||
buf.WriteString(GetDynamicBlockRefText(n))
|
buf.WriteString(GetDynamicBlockRefText(n))
|
||||||
lastSpace = false
|
lastSpace = false
|
||||||
return ast.WalkSkipChildren
|
return ast.WalkSkipChildren
|
||||||
case ast.NodeText, ast.NodeLinkText, ast.NodeLinkTitle, ast.NodeFileAnnotationRefText, ast.NodeFootnotesRef,
|
case ast.NodeLinkText:
|
||||||
|
buf.Write(n.Tokens)
|
||||||
|
buf.WriteByte(' ')
|
||||||
|
case ast.NodeLinkDest:
|
||||||
|
buf.Write(n.Tokens)
|
||||||
|
buf.WriteByte(' ')
|
||||||
|
case ast.NodeLinkTitle:
|
||||||
|
buf.Write(n.Tokens)
|
||||||
|
case ast.NodeText, ast.NodeFileAnnotationRefText, ast.NodeFootnotesRef,
|
||||||
ast.NodeCodeSpanContent, ast.NodeInlineMathContent, ast.NodeCodeBlockCode, ast.NodeMathBlockContent, ast.NodeHTMLBlock:
|
ast.NodeCodeSpanContent, ast.NodeInlineMathContent, ast.NodeCodeBlockCode, ast.NodeMathBlockContent, ast.NodeHTMLBlock:
|
||||||
buf.Write(n.Tokens)
|
buf.Write(n.Tokens)
|
||||||
case ast.NodeBackslash:
|
case ast.NodeBackslash:
|
||||||
|
|
@ -204,6 +212,7 @@ var typeAbbrMap = map[string]string{
|
||||||
// 行级元素
|
// 行级元素
|
||||||
"NodeText": "text",
|
"NodeText": "text",
|
||||||
"NodeLinkText": "link_text",
|
"NodeLinkText": "link_text",
|
||||||
|
"NodeLinkDest": "link_dest",
|
||||||
"NodeTag": "tag",
|
"NodeTag": "tag",
|
||||||
"NodeCodeSpan": "code_span",
|
"NodeCodeSpan": "code_span",
|
||||||
"NodeInlineMath": "inline_math",
|
"NodeInlineMath": "inline_math",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue