mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 Improve backmention highlighting https://github.com/siyuan-note/siyuan/issues/14103
This commit is contained in:
parent
c43da2fcaa
commit
6080f86693
1 changed files with 7 additions and 2 deletions
|
|
@ -748,11 +748,11 @@ func buildTreeBackmention(defSQLBlock *sql.Block, refBlocks []*Block, keyword st
|
|||
mentionKeywords = append(mentionKeywords, v.(string))
|
||||
}
|
||||
mentionKeywords = prepareMarkKeywords(mentionKeywords)
|
||||
ret = searchBackmention(mentionKeywords, keyword, excludeBacklinkIDs, rootID, beforeLen)
|
||||
mentionKeywords, ret = searchBackmention(mentionKeywords, keyword, excludeBacklinkIDs, rootID, beforeLen)
|
||||
return
|
||||
}
|
||||
|
||||
func searchBackmention(mentionKeywords []string, keyword string, excludeBacklinkIDs *hashset.Set, rootID string, beforeLen int) (ret []*Block) {
|
||||
func searchBackmention(mentionKeywords []string, keyword string, excludeBacklinkIDs *hashset.Set, rootID string, beforeLen int) (retMentionKeywords []string, ret []*Block) {
|
||||
ret = []*Block{}
|
||||
if 1 > len(mentionKeywords) {
|
||||
return
|
||||
|
|
@ -825,6 +825,9 @@ func searchBackmention(mentionKeywords []string, keyword string, excludeBacklink
|
|||
newText := markReplaceSpanWithSplit(text, mentionKeywords, search.GetMarkSpanStart(search.MarkDataType), search.GetMarkSpanEnd())
|
||||
if text != newText {
|
||||
tmp = append(tmp, b)
|
||||
|
||||
k := gulu.Str.SubstringsBetween(newText, search.GetMarkSpanStart(search.MarkDataType), search.GetMarkSpanEnd())
|
||||
retMentionKeywords = append(retMentionKeywords, k...)
|
||||
} else {
|
||||
// columnFilter 中的命名、别名和备注命中的情况
|
||||
// 反链提及搜索范围增加命名、别名和备注 https://github.com/siyuan-note/siyuan/issues/7639
|
||||
|
|
@ -836,6 +839,8 @@ func searchBackmention(mentionKeywords []string, keyword string, excludeBacklink
|
|||
}
|
||||
}
|
||||
blocks = tmp
|
||||
retMentionKeywords = gulu.Str.RemoveDuplicatedElem(retMentionKeywords)
|
||||
mentionKeywords = retMentionKeywords
|
||||
|
||||
mentionBlockMap := map[string]*Block{}
|
||||
for _, block := range blocks {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue