mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 搜索结果高亮支持大部分行级元素 https://github.com/siyuan-note/siyuan/issues/6745
This commit is contained in:
parent
92b88154fb
commit
7c40b44a15
9 changed files with 35 additions and 17 deletions
|
|
@ -16,6 +16,22 @@
|
|||
|
||||
package util
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/88250/lute/html"
|
||||
)
|
||||
|
||||
func EscapeHTML(s string) string {
|
||||
if strings.Contains(s, "&") {
|
||||
return s
|
||||
}
|
||||
if strings.ContainsAny(s, "<>\"'") {
|
||||
return html.EscapeString(s)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func Reverse(s string) string {
|
||||
runes := []rune(s)
|
||||
for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue