mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-04 07:48:49 +01:00
♻️ 搜索命中高亮
This commit is contained in:
parent
c56dcead19
commit
7d05f4e8c7
2 changed files with 20 additions and 6 deletions
|
|
@ -17,6 +17,7 @@
|
|||
package search
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
|
|
@ -99,3 +100,16 @@ func EncloseHighlighting(text string, keywords []string, openMark, closeMark str
|
|||
}
|
||||
return
|
||||
}
|
||||
|
||||
const (
|
||||
MarkDataType = "search-mark"
|
||||
VirtualBlockRefDataType = "virtual-block-ref"
|
||||
)
|
||||
|
||||
func GetMarkSpanStart(dataType string) string {
|
||||
return fmt.Sprintf("<span data-type=\"%s\">", dataType)
|
||||
}
|
||||
|
||||
func GetMarkSpanEnd() string {
|
||||
return "</span>"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue