mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 Improve backlink filtering below the heading https://github.com/siyuan-note/siyuan/issues/14929
This commit is contained in:
parent
669b2884b1
commit
5e040323f6
1 changed files with 10 additions and 1 deletions
|
|
@ -682,7 +682,7 @@ func buildLinkRefs(defRootID string, refs []*sql.Ref, keywords []string) (ret []
|
||||||
|
|
||||||
if matchBacklinkKeyword(child, keywords) {
|
if matchBacklinkKeyword(child, keywords) {
|
||||||
heading := headingRefChildren[child.ParentID]
|
heading := headingRefChildren[child.ParentID]
|
||||||
if nil != heading {
|
if nil != heading && !existBlock(heading, ret) {
|
||||||
ret = append(ret, heading)
|
ret = append(ret, heading)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -691,6 +691,15 @@ func buildLinkRefs(defRootID string, refs []*sql.Ref, keywords []string) (ret []
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func existBlock(block *Block, blocks []*Block) bool {
|
||||||
|
for _, b := range blocks {
|
||||||
|
if block.ID == b.ID {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func matchBacklinkKeyword(block *Block, keywords []string) bool {
|
func matchBacklinkKeyword(block *Block, keywords []string) bool {
|
||||||
if 1 > len(keywords) {
|
if 1 > len(keywords) {
|
||||||
return true
|
return true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue